[llvm-bugs] [Bug 31137] New: Wrong DSA for members in struct.

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Nov 23 06:43:49 PST 2016


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

            Bug ID: 31137
           Summary: Wrong DSA for members in struct.
           Product: OpenMP
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Clang Compiler Support
          Assignee: unassignedclangbugs at nondot.org
          Reporter: philippe.44 at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 17637
  --> https://llvm.org/bugs/attachment.cgi?id=17637&action=edit
Proposed patch

The following code fails with clang's master:
----
#include<assert.h>

struct s {
  int a;
  int b;
};

int main()
{
#pragma omp parallel
#pragma omp single
  {
    struct s S = {0,0};
#pragma omp task
    {
      /*(void)S;*/
      S.a = 1;
    }
#pragma omp taskwait
    assert(S.a == 0);
  }
}
----

'S' is detected as shared when I think it's actually firstprivate, it worked in
3.8, and uncommenting the "(void)S;" make it pass.

It seems that visiting MemberExpr when checking DSA attributes has been added
for 3.9, but the base is not visited if it's anything but a "this", when I
think it should.

I've attached a small patch fixing the bug, if my previous reasoning is ok it
should be enough.

I'm not sure about the follow up for this: please let me know if I should
submit the patch directly and if I should also submit one to add the small test
to libomp's testsuite.

-- 
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/20161123/147524f9/attachment.html>


More information about the llvm-bugs mailing list