llvm-project/flang/test/Semantics/smp-proc-ref.f90
Peter Klausler d1e4a2d300
[flang] Fix spurious error with separate module procedures (#106768)
When the implementation of one SMP apparently references another in what
might be a specification expression, semantics may need to resolve it as
a forward reference, and to allow for the replacement of a
SubprogramNameDetails place-holding symbol with the final
SubprogramDetails symbol. Otherwise, as in the bug report below,
confusing error messages may result.

(The reference in question isn't really in the specification part of a
subprogram, but due to the syntactic ambiguity between the array element
assignment statement and a statement function definition, it appears to
be so at the time that the reference is processed.)

I needed to make DumpSymbols() available via SemanticsContext to analyze
this bug, and left that new API in place to make things easier next
time.

Fixes https://github.com/llvm/llvm-project/issues/106705.
2024-09-04 10:54:46 -07:00

21 lines
314 B
Fortran

!RUN: %flang_fc1 -fsyntax-only %s
module m
real :: qux(10)
interface
module subroutine bar(i)
end
module function baz()
end
end interface
end
submodule(m) sm
contains
module procedure bar
qux(i) = baz() ! ensure no bogus error here
end
module procedure baz
baz = 1.
end
end