This is an archive of the discontinued LLVM Phabricator instance.

[flang] Support disabled alternative PARAMETER statement
ClosedPublic

Authored by klausler on Jan 29 2021, 1:36 PM.

Details

Summary

Legacy Fortran implementations support an alternative form of the
PARAMETER statement; it differs syntactically from the standard's
PARAMETER statement by lacking parentheses, and semantically by
using the type and shape of the initialization expression to define
the attributes of the named constant. (GNU Fortran gets that part
wrong; Intel Fortran and nvfortran have full support.)

This patch disables the old style PARAMETER statement by default, as
it is syntactically ambiguous with conforming assignment statements;
adds a new "-falternative-parameter-statement" option to enable it;
and implements it correctly when enabled.

Fixes https://bugs.llvm.org/show_bug.cgi?id=48774, in which a user
tripped over the syntactic ambiguity.

Diff Detail

Event Timeline

klausler created this revision.Jan 29 2021, 1:36 PM
klausler requested review of this revision.Jan 29 2021, 1:36 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 29 2021, 1:36 PM
tskeith accepted this revision.Jan 29 2021, 1:46 PM
This revision is now accepted and ready to land.Jan 29 2021, 1:46 PM
This revision was automatically updated to reflect the committed changes.

Thank you for working on this. I added -falternative-parameter-statement" to our progress tracker for the new driver.