[PATCH] D80590: [WIP][OPENMP] Fix assertion error for using alignas with OpenMP directive

Chi Chun Chen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 26 15:17:38 PDT 2020


cchen created this revision.
Herald added subscribers: cfe-commits, sstefan1, guansong, yaxunl.
Herald added a reviewer: jdoerfert.
Herald added a project: clang.
cchen added a comment.
cchen added a reviewer: ABataev.
cchen added subscribers: dreachem, sandoval.

Haven't added test yet since I'm not sure in which file should I add the test.


For the below case, Clang seems to regress (asserts) after https://github.com/llvm/llvm-project/commit/715f7a1bd058c64a39cc4773114dfb46ae8cc8a3

  struct FOO
  {
    static const int vec_align_bytes = 32;
  
    void foo()
    {
      alignas(vec_align_bytes) double a;
      a++;
    }
  
  };

We can avoid the assertion failure by either removing alignas or
OpenMP directive in the above code. It is apparent the usage of alignas
is resonable so the issue might be stem from OpenMP code.
In addition, replacing OpenMP directive with some arbitrary Clang directive
can avoid the assertion failure.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80590

Files:
  clang/lib/Sema/SemaOpenMP.cpp


Index: clang/lib/Sema/SemaOpenMP.cpp
===================================================================
--- clang/lib/Sema/SemaOpenMP.cpp
+++ clang/lib/Sema/SemaOpenMP.cpp
@@ -2631,6 +2631,7 @@
   DSAStack->pop();
   DiscardCleanupsInEvaluationContext();
   PopExpressionEvaluationContext();
+  CleanupVarDeclMarking();
 }
 
 static bool FinishOpenMPLinearClause(OMPLinearClause &Clause, DeclRefExpr *IV,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80590.266338.patch
Type: text/x-patch
Size: 406 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200526/334d02b1/attachment-0001.bin>


More information about the cfe-commits mailing list