[llvm-bugs] [Bug 46273] New: [OpenMP5.0] Clang violates OpenMP restrictions on the atomic construct

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jun 10 21:05:40 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=46273

            Bug ID: 46273
           Summary: [OpenMP5.0] Clang violates OpenMP restrictions on the
                    atomic construct
           Product: OpenMP
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Clang Compiler Support
          Assignee: unassignedclangbugs at nondot.org
          Reporter: sulinna at cn.fujitsu.com
                CC: llvm-bugs at lists.llvm.org

Hi, I am testing on OpenMP5.0 feature on clang10.0.0, 
and found clang does not conform to the OpenMP5.0 restrictions as below:

Restriction on the atomic Construct(C/C++):
All atomic accesses to the storage locations designated by x throughout the
program are required to have a compatible type.
https://www.openmp.org/spec-html/5.0/openmpsu95.html#x126-4840002.17.7

Test case:
---------------------------
void atomic_wrong ()
{
union {int n; float x;} u;

#pragma omp parallel
{
#pragma omp atomic update
u.n++;

 #pragma omp atomic update
 u.x += 1.0;

 /* Incorrect because the atomic constructs reference the same location
 through incompatible types */
}
}

Test command:
-----------------------------
# clang --version
clang version 10.0.0
Target: x86_64-unknown-linux-gnu
Thread model: posix
# clang -fopenmp-version=50 -fopenmp -S atomic_restrict.1.c

According to OpenMP5.0 atomic restriction, atomic accesses to the same storage
location required to have a compatible type, clang is expected return an error
message when compile the testcase, but clang compiled success.

I have looked into the clang source code SemaOpenMP.cpp, and found there is no
check about the above OpenMP5.0 atomic restriction in the Class
OpenMPAtomicUpdateChecker, The OpenMP5.0 atomic restriction check should be
implemented by clang for OpenMP5.0 support.

Thanks.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200611/d059dabe/attachment-0001.html>


More information about the llvm-bugs mailing list