Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions flang/include/flang/Semantics/symbol.h
Original file line number Diff line number Diff line change
Expand Up @@ -1126,6 +1126,9 @@ inline const DeclTypeSpec *Symbol::GetTypeImpl(int depth) const {
[&](const HostAssocDetails &x) {
return x.symbol().GetTypeImpl(depth);
},
[&](const GenericDetails &x) {
return x.specific() ? x.specific()->GetTypeImpl(depth) : nullptr;
},
[](const auto &) -> const DeclTypeSpec * { return nullptr; },
},
details_);
Expand Down
21 changes: 21 additions & 0 deletions flang/test/Semantics/Inputs/generic-shadows-specific-a.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
! these modules must be read from module files
module m1
interface f ! reference must be to generic
module procedure f ! must have same name as generic interface
end interface
contains
character function f() ! must be character
f = 'q'
end
end
module m2
use m1
end
module m3
use m2 ! must be m2, not m1
contains
subroutine mustExist() ! not called, but must exist
character x
x = f()
end
end
13 changes: 13 additions & 0 deletions flang/test/Semantics/generic-shadows-specific-b.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
! Check that expected code produced with no crash.
subroutine reproducer()
use m2
use m3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test failure you are seeing in the windows bot most likely comes from module file clashes.
LIT tests are run in parallel in the same folder.

Any tests that relies on writing and then reading a module file should be run in a temporary directory to avoid any troubles (m, m1, m2... are quite common name. It is OK when the test is a single compilation unit, but when doing several steps, the related module file will very likely be overridden).

You can use:

! RUN: rm -rf %t && mkdir -p %t

Also, as a nit, I think tests using -emit-fir/hlfir should live in test/Lower (there are a few precedent, but I do not think it is best practice). You can move it in test/Lower (there is no Input directory there, but you can achieve the same by making it single file test by using macros around the different steps of the compilation (see ./Semantics/modfile71.F90 for an example).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another way to allow tests with module files to run in parallel is to include the name of the test in the names of the modules.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for suggestions. I updated the test and moved to "Lower" subdir.

character x
x = f()
end

! RUN: %flang_fc1 -fsyntax-only %S/Inputs/generic-shadows-specific-a.f90
! RUN: bbc -emit-fir -o - %s | FileCheck %s

! CHECK-LABEL: func.func @_QPreproducer
! CHECK: fir.call @_QMm1Pf
Loading