Created attachment 15691 [details] Pre-processed source I don't know OpenMP or X86 very well so I'd appreciate some help debugging this. I've attached the pre-processed source and I'll attach the assembly shortly (bugzilla only allows one attachment during submit). Here's the llvm-lit output: /home/das-local/llvm-release-3.8/release/rc1/Phase3/Release/llvmCore-3.8.0-rc1.obj/./bin/clang -fopenmp=libomp -I /home/das-local/llvm-release-3.8/release/rc1/llvm.src/projects/openmp/runtime/test -I /home/das-local/llvm-release-3.8/release/rc1/Phase3/Release/llvmCore-3.8.0-rc1.obj/projects/openmp/runtime/src -L /home/das-local/llvm-release-3.8/release/rc1/Phase3/Release/llvmCore-3.8.0-rc1.obj/lib /home/das-local/llvm-release-3.8/release/rc1/openmp.src/runtime/test/barrier/omp_barrier.c -o /home/das-local/llvm-release-3.8/release/rc1/Phase3/Release/llvmCore-3.8.0-rc1.obj/projects/openmp/runtime/test/barrier/Output/omp_barrier.c.tmp -lm && /home/das-local/llvm-release-3.8/release/rc1/Phase3/Release/llvmCore-3.8.0-rc1.obj/projects/openmp/runtime/test/barrier/Output/omp_barrier.c.tmp -- Exit Code: 10 Command Output (stdout): -- Command 0: "/home/das-local/llvm-release-3.8/release/rc1/Phase3/Release/llvmCore-3.8.0-rc1.obj/./bin/clang" "-fopenmp=libomp" "-I" "/home/das-local/llvm-release-3.8/release/rc1/llvm.src/projects/openmp/runtime/test" "-I" "/home/das-local/llvm-release-3.8/release/rc1/Phase3/Release/llvmCore-3.8.0-rc1.obj/projects/openmp/runtime/src" "-L" "/home/das-local/llvm-release-3.8/release/rc1/Phase3/Release/llvmCore-3.8.0-rc1.obj/lib" "/home/das-local/llvm-release-3.8/release/rc1/openmp.src/runtime/test/barrier/omp_barrier.c" "-o" "/home/das-local/llvm-release-3.8/release/rc1/Phase3/Release/llvmCore-3.8.0-rc1.obj/projects/openmp/runtime/test/barrier/Output/omp_barrier.c.tmp" "-lm" Command 0 Result: 0 Command 0 Output: Command 0 Stderr: Command 1: "/home/das-local/llvm-release-3.8/release/rc1/Phase3/Release/llvmCore-3.8.0-rc1.obj/projects/openmp/runtime/test/barrier/Output/omp_barrier.c.tmp" Command 1 Result: 10 Command 1 Output: Command 1 Stderr:
Created attachment 15692 [details] Assembly
From my understanding, inside a parallel region the return value of omp_get_thread_num() varies from 0 to omp_get_num_threads()-1 inclusive. However, the rank variable, which holds the return value from that function, is tested for equality only with 1 and 2. If the total number of threads is 2, as it was in my case when testing on CI20 board with 2 cores, then this test will fail either way.
I think you're right, I'm running on a 2-core machine too and this test assumes there are at least three threads. I've tried it on a 4-core machine and the test passes there unless I limit it to two threads with OMP_NUM_THREADS. I've read a small amount of the openmp spec and it seems that this test doesn't really need the third thread so I've posted http://reviews.llvm.org/D16532.
Fixed in r258695 and merged in r258719