This is an archive of the discontinued LLVM Phabricator instance.

[flang] Fix edge case in USE-associated generics
ClosedPublic

Authored by klausler on Feb 11 2022, 10:52 AM.

Details

Summary

It is generally an error when a USE-associated name clashes
with a name defined locally, but not in all cases; a generic
interface can be both USE-associated and locally defined.
This works, but not when there is also a local subprogram
with the same name, which is valid when that subprogram is
a specific of the local generic. A bogus error issues at
the point of the USE because name resolution will have already
defined a symbol for the local subprogram.

The solution is to collect the names of local generics when
creating the program tree, and then create their symbols as
well if their names are also local subprograms, prior to any
USE association processing.

Diff Detail

Event Timeline

klausler created this revision.Feb 11 2022, 10:52 AM
klausler requested review of this revision.Feb 11 2022, 10:52 AM
PeteSteinfeld accepted this revision.Feb 11 2022, 12:36 PM

All builds and tests correctly and looks good.

This revision is now accepted and ready to land.Feb 11 2022, 12:36 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 11 2022, 4:55 PM

Just want to give you a heads-up that there are 3 LIT failures for to this commit:
TestCases/Linux/asan_dlopen_test.cpp
TestCases/Integer/sub-overflow.cpp
TestCases/Integer/uadd-overflow.cpp
Please investigate.

Just want to give you a heads-up that there are 3 LIT failures for to this commit:
TestCases/Linux/asan_dlopen_test.cpp
TestCases/Integer/sub-overflow.cpp
TestCases/Integer/uadd-overflow.cpp
Please investigate.

I don't recognize those as tests in flang; do you have a link to the failures? It is highly unlikely that a change to Fortran semantics would affect any test not involving flang.

I don't recognize those as tests in flang; do you have a link to the failures? It is highly unlikely that a change to Fortran semantics would affect any test not involving flang.

The issue has been resolved with a later commit that I hadn't pulled at the time. Please ignore my original comment. Sorry about this.