This is an archive of the discontinued LLVM Phabricator instance.

[flang] Fix folding of ac-implied-do indices in structure c'tors
ClosedPublic

Authored by klausler on Dec 9 2021, 2:14 PM.

Details

Summary

Array constructors with implied DO loops that oversee structure
constructors were being prematurely folded into invalid constants
containing symbolic references to the ac-implied-do indices,
because they are indeed "constant expressions" as that term is
used in the Fortran standard and implemented as IsConstantExpr().
What's actually needed in structure constructor folding is a
test for actual constant values, which is what results from
folding them later with repetition in the context of folding
an ac-implied-do.

Diff Detail

Event Timeline

klausler created this revision.Dec 9 2021, 2:14 PM
klausler requested review of this revision.Dec 9 2021, 2:14 PM
vdonaldson accepted this revision.Dec 9 2021, 2:23 PM
This revision is now accepted and ready to land.Dec 9 2021, 2:23 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 9 2021, 6:03 PM