From 2e7cee9c6e3165dacab140885cabc3247413344e Mon Sep 17 00:00:00 2001 From: Michael Klemm Date: Sun, 15 Mar 2026 21:44:13 +0100 Subject: [PATCH 1/3] Test for THREADPRIVATE variables in EQUIVALENCE statement --- test/smoke-fort-dev/llvm-180493/Makefile | 19 +++++++++ test/smoke-fort-dev/llvm-180493/equiv.f90 | 49 +++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 test/smoke-fort-dev/llvm-180493/Makefile create mode 100644 test/smoke-fort-dev/llvm-180493/equiv.f90 diff --git a/test/smoke-fort-dev/llvm-180493/Makefile b/test/smoke-fort-dev/llvm-180493/Makefile new file mode 100644 index 000000000..b5699ea60 --- /dev/null +++ b/test/smoke-fort-dev/llvm-180493/Makefile @@ -0,0 +1,19 @@ +#NOOPT = 1 +#NOOMP = 1 +#OMP_FLAGS = -DNO_OMP +include ../../Makefile.defs + +TESTNAME = equiv +TESTSRC_MAIN = equiv.f90 +TESTSRC_ALL = $(TESTSRC_MAIN) + +FLANG = flang +CFLAGS = -fopenmp +OMP_BIN = $(AOMP)/bin/$(FLANG) +CC = $(OMP_BIN) $(VERBOSE) +#-ccc-print-phases +#"-\#\#\#" + +RUNCMD = ./equiv + +include ../Makefile.rules diff --git a/test/smoke-fort-dev/llvm-180493/equiv.f90 b/test/smoke-fort-dev/llvm-180493/equiv.f90 new file mode 100644 index 000000000..d7d5d432b --- /dev/null +++ b/test/smoke-fort-dev/llvm-180493/equiv.f90 @@ -0,0 +1,49 @@ +program equiv + use omp_lib + implicit none + common/ba/ a,b,c + integer :: a,b,c + integer :: x,y,z + + integer, parameter :: nthreads = 4 + integer :: i + integer :: chk + + logical :: failed + + !$omp threadprivate(/ba/) + + equivalence (x,a) + equivalence (y,a) + + failed = .false. + + !$omp parallel num_threads(nthreads) shared(failed) private(chk) + x = 21 + chk = 21 + !$omp masked filter(1) + x = 42 + chk = 42 + !$omp end masked + + !$omp barrier + + a = a + omp_get_thread_num() + chk = chk + omp_get_thread_num() + + !$omp barrier + do i = 0, nthreads-1 + if (omp_get_thread_num() == i) then + print '(I3,I5)', omp_get_thread_num(), a + if (chk /= a) then + failed = .true. + end if + end if + !$omp barrier + end do + !$omp end parallel + + if (failed) then + stop 1 + end if +end program equiv From a1cff6839ed5ae55fc585b4c82faf488e5e66106 Mon Sep 17 00:00:00 2001 From: Michael Klemm Date: Tue, 17 Mar 2026 09:56:48 +0100 Subject: [PATCH 2/3] Add test for variable y --- test/smoke-fort-dev/llvm-180493/equiv.f90 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/smoke-fort-dev/llvm-180493/equiv.f90 b/test/smoke-fort-dev/llvm-180493/equiv.f90 index d7d5d432b..de83dd891 100644 --- a/test/smoke-fort-dev/llvm-180493/equiv.f90 +++ b/test/smoke-fort-dev/llvm-180493/equiv.f90 @@ -26,6 +26,11 @@ program equiv chk = 42 !$omp end masked + !$omp masked filter(2) + y = 10 + chk = 10 + !$omp end masked + !$omp barrier a = a + omp_get_thread_num() From f68c771855addd8ce501a0a614fd2a3f9ddc268a Mon Sep 17 00:00:00 2001 From: Michael Klemm Date: Fri, 24 Apr 2026 11:50:28 +0200 Subject: [PATCH 3/3] Implement reviewer feedback --- test/smoke-fort-dev/llvm-180493/Makefile | 2 +- test/smoke-fort-dev/llvm-180493/equiv.f90 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/smoke-fort-dev/llvm-180493/Makefile b/test/smoke-fort-dev/llvm-180493/Makefile index b5699ea60..b95ffdf5c 100644 --- a/test/smoke-fort-dev/llvm-180493/Makefile +++ b/test/smoke-fort-dev/llvm-180493/Makefile @@ -7,7 +7,7 @@ TESTNAME = equiv TESTSRC_MAIN = equiv.f90 TESTSRC_ALL = $(TESTSRC_MAIN) -FLANG = flang +FLANG ?= amdflang CFLAGS = -fopenmp OMP_BIN = $(AOMP)/bin/$(FLANG) CC = $(OMP_BIN) $(VERBOSE) diff --git a/test/smoke-fort-dev/llvm-180493/equiv.f90 b/test/smoke-fort-dev/llvm-180493/equiv.f90 index de83dd891..cf330f49f 100644 --- a/test/smoke-fort-dev/llvm-180493/equiv.f90 +++ b/test/smoke-fort-dev/llvm-180493/equiv.f90 @@ -18,7 +18,7 @@ program equiv failed = .false. - !$omp parallel num_threads(nthreads) shared(failed) private(chk) + !$omp parallel num_threads(nthreads) shared(failed) private(i,chk) x = 21 chk = 21 !$omp masked filter(1)