This is an archive of the discontinued LLVM Phabricator instance.

[flang] Improve error message for misuse of NULL(mold) as data statement constant
ClosedPublic

Authored by klausler on Oct 28 2021, 11:14 AM.

Details

Summary

While "null()" is accepted as a data statement constant when it
corresponds to a pointer object, "null(mold=p)" and "null(p)"
are not allowed. The current error messages simply complain
that null is not an array. This patch adds a context-sensitive
message to the effect that a data statement constant followed
by non-empty parentheses must be an array or structure constructor.

(Note that f18 can't simply special-case the name "null" when parsing
data statement constants, since programs are free to repurpose that
name as an array or derived type.)

Diff Detail

Event Timeline

klausler created this revision.Oct 28 2021, 11:14 AM
klausler requested review of this revision.Oct 28 2021, 11:14 AM
schweitz accepted this revision.Oct 28 2021, 3:19 PM
This revision is now accepted and ready to land.Oct 28 2021, 3:19 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 28 2021, 3:20 PM