This is an archive of the discontinued LLVM Phabricator instance.

[flang] Don't emit faulty warnings for illegal COMMON blocks
ClosedPublic

Authored by ekieri on Aug 22 2022, 11:46 AM.

Details

Summary

SAVE statements referencing COMMON block names are not allowed in BLOCK
constructs. If they occur, an error is correctly emitted, but then flang
gets confused by the illegal SAVE and produces a faulty warning. This
patch removes that warning.

Consider this piece of Fortran (from the test blockconstruct02.f90):

program main

real r, s, t
common /argmnt2/ r, s, t
block
  save /argmnt2/
end block

end program

Here flang (in addition to the error about the illegal SAVE) emits a
portability warning saying that the two definitions of argmnt2 have
different size, which does not make much sense.

This patch is a prerequisite for D125804, which in turn will make
blockconstruct02.f90 test this patch.

Diff Detail

Event Timeline

ekieri created this revision.Aug 22 2022, 11:46 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptAug 22 2022, 11:46 AM
ekieri requested review of this revision.Aug 22 2022, 11:46 AM
jeanPerier accepted this revision.Aug 26 2022, 1:05 AM

LGTM, thanks

This revision is now accepted and ready to land.Aug 26 2022, 1:05 AM