llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

Flang emits incorrect warning about return statement in the main program

Open chilikink opened this issue 4 years ago • 4 comments

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
  ^^^^^^

chilikink avatar Apr 25 '22 20:04 chilikink

@llvm/issue-subscribers-flang-frontend

llvmbot avatar Apr 25 '22 20:04 llvmbot

Thanks for this report! I could reproduce this with a HEAD of today (9197959e131e), and am working on a fix.

ekieri avatar Apr 28 '22 20:04 ekieri

Up for review here: https://reviews.llvm.org/D124732

ekieri avatar May 01 '22 07:05 ekieri

Fixed in above mentioned patch. This issue was not closed automatically due to a typo, so I'll close manually.

ekieri avatar May 03 '22 15:05 ekieri