Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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: 2 additions & 1 deletion flang/lib/Semantics/resolve-names.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3376,7 +3376,8 @@ bool ScopeHandler::CheckPossibleBadForwardRef(const Symbol &symbol) {
context().SetError(symbol);
return true;
}
if ((IsDummy(symbol) || FindCommonBlockContaining(symbol)) &&
if ((IsDummy(symbol) ||
(!symbol.has<UseDetails>() && FindCommonBlockContaining(symbol))) &&
isImplicitNoneType() && symbol.test(Symbol::Flag::Implicit) &&
!context().HasError(symbol)) {
// Dummy or COMMON was implicitly typed despite IMPLICIT NONE(TYPE) in
Expand Down
11 changes: 11 additions & 0 deletions flang/test/Semantics/bug159977.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
! RUN: %flang_fc1 -fsyntax-only -pedantic %s 2>&1 | FileCheck %s --allow-empty
! Ensure no bogus "no explicit type for ..." error on USE-associated
! implicitly-typed COMMON block object in scope with IMPLICIT NONE.
! CHECK-NOT: error:
module m
common /block/ var
end
subroutine test
use m
implicit none
end