LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 26253 - libomp fails runtime/test/barrier/omp_barrier.c for X86
Summary: libomp fails runtime/test/barrier/omp_barrier.c for X86
Status: RESOLVED FIXED
Alias: None
Product: OpenMP
Classification: Unclassified
Component: Runtime Library (show other bugs)
Version: unspecified
Hardware: PC Linux
: P normal
Assignee: Daniel Sanders
URL:
Keywords:
Depends on:
Blocks: 26059
  Show dependency tree
 
Reported: 2016-01-22 04:01 PST by Daniel Sanders
Modified: 2016-01-26 07:22 PST (History)
3 users (show)

See Also:
Fixed By Commit(s):


Attachments
Pre-processed source (52.10 KB, application/octet-stream)
2016-01-22 04:01 PST, Daniel Sanders
Details
Assembly (4.53 KB, application/octet-stream)
2016-01-22 04:01 PST, Daniel Sanders
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Sanders 2016-01-22 04:01:05 PST
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:
Comment 1 Daniel Sanders 2016-01-22 04:01:34 PST
Created attachment 15692 [details]
Assembly
Comment 2 Vasileios Kalintiris 2016-01-23 13:07:09 PST
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.
Comment 3 Daniel Sanders 2016-01-25 09:20:38 PST
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.
Comment 4 Daniel Sanders 2016-01-26 07:22:02 PST
Fixed in r258695 and merged in r258719