Flang emits incorrect warning about return statement in the main program
Compilation of the following code
SUBROUTINE S()
RETURN
END SUBROUTINE
with flang on the branch release/14.x (commit 9a3e81e1f91fa8793857fdfdacfd7e70ac365bb8) results in an incorrect warning about return statement in the main program (there is actually no main program) if the flag -std=f2018 is used:
$ /opt/llvm-14.0.0/bin/flang -std=f2018 -Wall -c test.f90
./test.f90:2:1: RETURN should not appear in a main program
RETURN
^^^^^^
@llvm/issue-subscribers-flang-frontend
Thanks for this report! I could reproduce this with a HEAD of today (9197959e131e), and am working on a fix.
Up for review here: https://reviews.llvm.org/D124732
Fixed in above mentioned patch. This issue was not closed automatically due to a typo, so I'll close manually.