This is an archive of the discontinued LLVM Phabricator instance.

[Flang][OpenMP][Sema] More gracefully handle undefined symbol in a no implicit module for declare target
ClosedPublic

Authored by agozillon on May 4 2023, 3:38 PM.

Details

Summary

Prior to this change, if you define a module as such with a declare target in it:

module test_0
    implicit none
!$omp declare target(no_implicit_materialization_1)
end module test_0

The compiler will crash rather than give some form of reasonable
diagnostic. This patch attempts to fix that.

From what I understand of Fortran, if I remove the implicit none
from the example module, the above code perhaps becomes
legal, as Fortran seems happy to materialize a type for symbols to
make them a variable. Although, I'm not sure what Fortrans
interactions are with implicitly defining variables inside of a
pragma/directive. At the very least Flang does this happily
at the semantic level for the moment.

Diff Detail

Event Timeline

agozillon created this revision.May 4 2023, 3:38 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript
agozillon requested review of this revision.May 4 2023, 3:38 PM
This revision is now accepted and ready to land.May 5 2023, 1:52 AM

Thank you @kiranchandramohan for the quick review!