public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/marxin/heads/PR99877-asan-in-openmp-context)] ASAN: do not unpoison in OpenMP context
@ 2021-04-12  8:50 Martin Liska
  0 siblings, 0 replies; only message in thread
From: Martin Liska @ 2021-04-12  8:50 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:c45df30ed189f49d8dee414ce6cb425461f883b9

commit c45df30ed189f49d8dee414ce6cb425461f883b9
Author: Martin Liska <mliska@suse.cz>
Date:   Mon Apr 12 10:49:41 2021 +0200

    ASAN: do not unpoison in OpenMP context
    
    gcc/ChangeLog:
    
            PR sanitizer/99877
            * gimplify.c (gimplify_expr): Right now, we unpoison all
            variables before a goto <dest>. We should not do it if we are
            in a omp context.
    
    gcc/testsuite/ChangeLog:
    
            PR sanitizer/99877
            * g++.dg/asan/pr99877.C: New test.

Diff:
---
 gcc/gimplify.c                      |  3 ++-
 gcc/testsuite/g++.dg/asan/pr99877.C | 19 +++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 1f417a52702..b65106b1459 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -14328,7 +14328,8 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
 	     Doing so would prevent us from reporting a false positives.  */
 	  if (asan_poisoned_variables
 	      && asan_used_labels != NULL
-	      && asan_used_labels->contains (label))
+	      && asan_used_labels->contains (label)
+	      && !gimplify_omp_ctxp)
 	    asan_poison_variables (asan_poisoned_variables, false, pre_p);
 	  break;
 
diff --git a/gcc/testsuite/g++.dg/asan/pr99877.C b/gcc/testsuite/g++.dg/asan/pr99877.C
new file mode 100644
index 00000000000..95a86411405
--- /dev/null
+++ b/gcc/testsuite/g++.dg/asan/pr99877.C
@@ -0,0 +1,19 @@
+/* PR sanitizer/99877*/
+/* { dg-options "-fsanitize=address -fopenmp -O2" } */
+
+struct vector
+{
+  int size ();
+};
+int
+main ()
+{
+  vector outqueue;
+#pragma omp parallel
+  {
+    goto continueloop;
+  continueloop:;
+  }
+  for (; outqueue.size ();)
+    ;
+}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-04-12  8:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-12  8:50 [gcc(refs/users/marxin/heads/PR99877-asan-in-openmp-context)] ASAN: do not unpoison in OpenMP context Martin Liska

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).