aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Lyon <christophe.lyon@linaro.org>2017-04-19 12:42:56 +0000
committerChristophe Lyon <christophe.lyon@linaro.org>2017-05-04 15:05:44 +0000
commit5ea732eb558a00a71abe5c1874ec836b3a74e7b2 (patch)
treef013a53e1795bc6b0d7c69e1db5107da1888413c
parente84066d083989ee58de326b5ee0d054b0a2e72d8 (diff)
bug-1925: New test.
Uses tcwg-tk1-01 to execute the generated program. Change-Id: I7ac1dde8fab1f0f0f055b715046023715392d429
-rw-r--r--bug-1925/Makefile1
-rwxr-xr-xbug-1925/build.sh24
-rw-r--r--bug-1925/retval1.f90120
-rw-r--r--common.mk4
4 files changed, 149 insertions, 0 deletions
diff --git a/bug-1925/Makefile b/bug-1925/Makefile
new file mode 100644
index 0000000..23f8a8f
--- /dev/null
+++ b/bug-1925/Makefile
@@ -0,0 +1 @@
+include ../common.mk
diff --git a/bug-1925/build.sh b/bug-1925/build.sh
new file mode 100755
index 0000000..ed22bcd
--- /dev/null
+++ b/bug-1925/build.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+set -e
+
+case ${TARGET} in
+ *arm*linux*)
+ # Only Linux toolchains support fortran
+ CFLAGS="-lgfortran -foffload=-lgfortran -fopenmp -static"
+ ;;
+ *)
+ echo "$(basename $(pwd)): SKIP" > result.txt
+ exit 0
+ ;;
+esac
+
+echo "$(basename $(pwd)): FAIL" > result.txt
+set -x
+${FCC} retval1.f90 -o retval1.exe ${CFLAGS}
+OUT=/tmp/retval1.exe.$$
+scp retval1.exe ${AARCH32BOARD}:${OUT}
+trap "ssh ${AARCH32BOARD} rm ${OUT}" EXIT
+ssh ${AARCH32BOARD} chmod +x ${OUT}
+ssh ${AARCH32BOARD} ${OUT}
+set +x
+echo "$(basename $(pwd)): PASS" > result.txt
diff --git a/bug-1925/retval1.f90 b/bug-1925/retval1.f90
new file mode 100644
index 0000000..b259457
--- /dev/null
+++ b/bug-1925/retval1.f90
@@ -0,0 +1,120 @@
+! { dg-do run }
+
+function f1 ()
+ use omp_lib
+ real :: f1
+ logical :: l
+ f1 = 6.5
+ l = .false.
+!$omp parallel firstprivate (f1) num_threads (2) reduction (.or.:l)
+ l = f1 .ne. 6.5
+ if (omp_get_thread_num () .eq. 0) f1 = 8.5
+ if (omp_get_thread_num () .eq. 1) f1 = 14.5
+!$omp barrier
+ l = l .or. (omp_get_thread_num () .eq. 0 .and. f1 .ne. 8.5)
+ l = l .or. (omp_get_thread_num () .eq. 1 .and. f1 .ne. 14.5)
+!$omp end parallel
+ if (l) call abort
+ f1 = -2.5
+end function f1
+function f2 ()
+ use omp_lib
+ real :: f2, e2
+ logical :: l
+entry e2 ()
+ f2 = 6.5
+ l = .false.
+!$omp parallel firstprivate (e2) num_threads (2) reduction (.or.:l)
+ l = e2 .ne. 6.5
+ if (omp_get_thread_num () .eq. 0) e2 = 8.5
+ if (omp_get_thread_num () .eq. 1) e2 = 14.5
+!$omp barrier
+ l = l .or. (omp_get_thread_num () .eq. 0 .and. e2 .ne. 8.5)
+ l = l .or. (omp_get_thread_num () .eq. 1 .and. e2 .ne. 14.5)
+!$omp end parallel
+ if (l) call abort
+ e2 = 7.5
+end function f2
+function f3 ()
+ use omp_lib
+ real :: f3, e3
+ logical :: l
+entry e3 ()
+ f3 = 6.5
+ l = .false.
+!$omp parallel firstprivate (f3, e3) num_threads (2) reduction (.or.:l)
+ l = e3 .ne. 6.5
+ l = l .or. f3 .ne. 6.5
+ if (omp_get_thread_num () .eq. 0) e3 = 8.5
+ if (omp_get_thread_num () .eq. 1) e3 = 14.5
+ f3 = e3 - 4.5
+!$omp barrier
+ l = l .or. (omp_get_thread_num () .eq. 0 .and. e3 .ne. 8.5)
+ l = l .or. (omp_get_thread_num () .eq. 1 .and. e3 .ne. 14.5)
+ l = l .or. f3 .ne. e3 - 4.5
+!$omp end parallel
+ if (l) call abort
+ e3 = 0.5
+end function f3
+function f4 () result (r4)
+ use omp_lib
+ real :: r4, s4
+ logical :: l
+entry e4 () result (s4)
+ r4 = 6.5
+ l = .false.
+!$omp parallel firstprivate (r4, s4) num_threads (2) reduction (.or.:l)
+ l = s4 .ne. 6.5
+ l = l .or. r4 .ne. 6.5
+ if (omp_get_thread_num () .eq. 0) s4 = 8.5
+ if (omp_get_thread_num () .eq. 1) s4 = 14.5
+ r4 = s4 - 4.5
+!$omp barrier
+ l = l .or. (omp_get_thread_num () .eq. 0 .and. s4 .ne. 8.5)
+ l = l .or. (omp_get_thread_num () .eq. 1 .and. s4 .ne. 14.5)
+ l = l .or. r4 .ne. s4 - 4.5
+!$omp end parallel
+ if (l) call abort
+ s4 = -0.5
+end function f4
+function f5 (is_f5)
+ use omp_lib
+ real :: f5
+ integer :: e5
+ logical :: l, is_f5
+entry e5 (is_f5)
+ if (is_f5) then
+ f5 = 6.5
+ else
+ e5 = 8
+ end if
+ l = .false.
+!$omp parallel firstprivate (f5, e5) shared (is_f5) num_threads (2) &
+!$omp reduction (.or.:l)
+ if (.not. is_f5) l = l .or. e5 .ne. 8
+ if (is_f5) l = l .or. f5 .ne. 6.5
+ if (omp_get_thread_num () .eq. 0) e5 = 8
+ if (omp_get_thread_num () .eq. 1) e5 = 14
+ f5 = e5 - 4.5
+!$omp barrier
+ l = l .or. (omp_get_thread_num () .eq. 0 .and. e5 .ne. 8)
+ l = l .or. (omp_get_thread_num () .eq. 1 .and. e5 .ne. 14)
+ l = l .or. f5 .ne. e5 - 4.5
+!$omp end parallel
+ if (l) call abort
+ if (is_f5) f5 = -2.5
+ if (.not. is_f5) e5 = 8
+end function f5
+
+ real :: f1, f2, e2, f3, e3, f4, e4, f5
+ integer :: e5
+ if (f1 () .ne. -2.5) call abort
+ if (f2 () .ne. 7.5) call abort
+ if (e2 () .ne. 7.5) call abort
+ if (f3 () .ne. 0.5) call abort
+ if (e3 () .ne. 0.5) call abort
+ if (f4 () .ne. -0.5) call abort
+ if (e4 () .ne. -0.5) call abort
+ if (f5 (.true.) .ne. -2.5) call abort
+ if (e5 (.false.) .ne. 8) call abort
+end
diff --git a/common.mk b/common.mk
index a210ed9..7250827 100644
--- a/common.mk
+++ b/common.mk
@@ -13,10 +13,14 @@ endif
export CC=$(WINE) $(TOOLCHAIN)/bin/$(TARGET)-gcc $(EXTRA_CFLAGS)
export CXX=$(WINE) $(TOOLCHAIN)/bin/$(TARGET)-g++ $(EXTRA_CFLAGS)
+export FCC=$(WINE) $(TOOLCHAIN)/bin/$(TARGET)-gfortran $(EXTRA_CFLAGS)
export HOSTCC=gcc
export HOSTCXX=g++
+export AARCH32BOARD=tcwg-tk1-01.tcwglab
+export AARCH64BOARD=tcwg-tx1-01.tcwglab
+
check::
-$(MAKE) all
@cat result.txt