mirror-llvm-project/flang/test/Semantics/bug1092.F90
Peter Klausler 2b7e3f6fa6
[flang] Unify derived types in distinct module files (#146759)
When using -fhermetic-module-files it's possible for a derived type to
have multiple distinct definition sites that are being compared for
being the same type, as in argument association. Accept them as being
the same type so long as they have the same names, the same module
names, and identical definitions.
2025-07-03 14:34:16 -07:00

26 lines
508 B
Fortran

!RUN: rm -rf %t && mkdir -p %t
!RUN: %flang_fc1 -DWHICH=1 -fsyntax-only -J%t %s
!RUN: %flang_fc1 -DWHICH=2 -fsyntax-only -fhermetic-module-files -I%t -J%t %s
!RUN: %flang_fc1 -fsyntax-only -I%t %s 2>&1 | FileCheck --allow-empty %s
!CHECK-NOT: error:
#if WHICH == 1
module bug1092a
type t
end type
contains
subroutine subr(x)
type(t) x
end
end
#elif WHICH == 2
module bug1092b
use bug1092a, only: subr
end
#else
use bug1092a, only: t
use bug1092b, only: subr
type(t) x
call subr(x)
end
#endif