This is an archive of the discontinued LLVM Phabricator instance.

[flang] Fix pointer definition semantic checking via refactoring
ClosedPublic

Authored by klausler on Oct 28 2022, 1:38 PM.

Details

Summary

The infrastructure in semantics that is used to check that the
left-hand sides of normal assignment statements are really definable
variables was not being used to check whether the LHSs of pointer assignments
are modifiable, and so most cases of unmodifiable pointers are left
undiagnosed. Rework the semantics checking for pointer assignments,
NULLIFY statements, pointer dummy arguments, &c. so that cases of
unmodifiable pointers are properly caught. This has been done
by extracting all the various definability checking code that has
been implemented for different contexts in Fortran into one new
facility.

The new consolidated definability checking code returns messages
meant to be attached as "because: " explanations to context-dependent
errors like "left-hand side of assignment is not definable".
These new error message texts and their attached explanations
affect many existing tests, which have been updated. The testing
infrastructure was extended by another patch to properly compare
warnings and explanatory messages, which had been ignored until
recently.

Diff Detail

Event Timeline

klausler created this revision.Oct 28 2022, 1:38 PM
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a subscriber: jdoerfert. · View Herald Transcript
klausler requested review of this revision.Oct 28 2022, 1:38 PM
klausler updated this revision to Diff 471661.Oct 28 2022, 2:55 PM

Update error messages in two newer tests.

PeteSteinfeld requested changes to this revision.Oct 28 2022, 3:04 PM

Things generally look good, but I'm getting failures in the tests Semantics/atomic[06,08].f90.

This revision now requires changes to proceed.Oct 28 2022, 3:04 PM
klausler updated this revision to Diff 471855.Oct 30 2022, 11:56 AM

All test issues are resolved.

Please take another look.

PeteSteinfeld accepted this revision.Oct 30 2022, 7:09 PM

All builds and tests correctly and looks good.

Thanks for fixing this!

This revision is now accepted and ready to land.Oct 30 2022, 7:09 PM