Files
TheRock/compiler/amd-llvm/flang/test/Lower/module-single-point-of-def.f90
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

79 lines
2.3 KiB
Fortran

! Test that module variables with an initializer are only defined once,
! except for compiler generated derived type descriptor that should be
! always fully defined as linkonce_odr by the compilation units defining or
! using them.
! Test that this holds true in contexts with namelist members that are special
! because the symbol on the use site are not symbols with semantics::UseDetails,
! but directly the symbols from the module scope.
! RUN: split-file %s %t
! RUN: bbc -emit-fir %t/definition-a.f90 -o - | FileCheck %s --check-prefix=CHECK-A-DEF
! RUN: bbc -emit-fir %t/definition-b.f90 -o - | FileCheck %s --check-prefix=CHECK-B-DEF
! RUN: bbc -emit-fir %t/use.f90 -o - | FileCheck %s --check-prefix=CHECK-USE
!--- definition-a.f90
! Test definition of `atype` derived type descriptor as `linkonce_odr`
module define_a
type atype
real :: x
end type
end module
! CHECK-A-DEF: fir.global linkonce_odr @_QMdefine_aE.dt.atype constant target : !fir.type<{{.*}}> {
! CHECK-A-DEF: fir.has_value
! CHECK-A-DEF: }
!--- definition-b.f90
! Test define_b `i` is defined here.
! Also test that the derived type descriptor of types defined here (`btype`) and used
! here (`atype`) are fully defined here as linkonce_odr.
module define_b
use :: define_a
type btype
type(atype) :: atype
end type
integer :: i = 42
namelist /some_namelist/ i
end module
! CHECK-B-DEF: fir.global @_QMdefine_bEi : i32 {
! CHECK-B-DEF: fir.has_value %{{.*}} : i32
! CHECK-B-DEF: }
! CHECK-B-DEF: fir.global linkonce_odr @_QMdefine_bE.dt.btype constant target : !fir.type<{{.*}}> {
! CHECK-B-DEF: fir.has_value
! CHECK-B-DEF: }
! CHECK-B-DEF: fir.global linkonce_odr @_QMdefine_aE.dt.atype constant : !fir.type<{{.*}}> {
! CHECK-B-DEF: fir.has_value
! CHECK-B-DEF: }
!--- use.f90
! Test define_b `i` is declared but not defined here and that derived types
! descriptors are fully defined as linkonce_odr here.
subroutine foo()
use :: define_b
type(btype) :: somet
print *, somet
write(*, some_namelist)
end subroutine
! CHECK-USE: fir.global @_QMdefine_bEi : i32{{$}}
! CHECK-USE-NOT: fir.has_value %{{.*}} : i32
! CHECK-USE: fir.global linkonce_odr @_QMdefine_aE.dt.atype constant : !fir.type<{{.*}}> {
! CHECK-USE: fir.has_value
! CHECK-USE: }
! CHECK-USE: fir.global linkonce_odr @_QMdefine_bE.dt.btype constant : !fir.type<{{.*}}> {
! CHECK-USE: fir.has_value
! CHECK-USE: }