[Bug sanitizer/85081] [7/8 Regression] Sanitizer error with references in vectorized/parallel for-loop

2018-03-28 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85081

--- Comment #3 from Martin Liška  ---
Author: marxin
Date: Wed Mar 28 14:45:21 2018
New Revision: 258924

URL: https://gcc.gnu.org/viewcvs?rev=258924=gcc=rev
Log:
Fix wrong use-after-scope sanitization for omp variable (PR sanitizer/85081).

2018-03-28  Jakub Jelinek  
Martin Liska  

PR sanitizer/85081
* gimplify.c (asan_poison_variable): Don't do the check for
gimplify_omp_ctxp here.
(gimplify_decl_expr): Do it here.
(gimplify_target_expr): Likewise.
2018-03-28  Jakub Jelinek  
Martin Liska  

PR sanitizer/85081
* g++.dg/asan/pr85081.C: New test.

Added:
trunk/gcc/testsuite/g++.dg/asan/pr85081.C
Modified:
trunk/gcc/ChangeLog
trunk/gcc/gimplify.c
trunk/gcc/testsuite/ChangeLog

[Bug sanitizer/85081] [7/8 Regression] Sanitizer error with references in vectorized/parallel for-loop

2018-03-27 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85081

Martin Liška  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |marxin at gcc dot 
gnu.org

--- Comment #2 from Martin Liška  ---
I'll take a look tomorrow.

[Bug sanitizer/85081] [7/8 Regression] Sanitizer error with references in vectorized/parallel for-loop

2018-03-27 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85081

Jakub Jelinek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-03-27
 Ever confirmed|0   |1

--- Comment #1 from Jakub Jelinek  ---
Martin, this is because of:
  /* When within an OMP context, do not emit ASAN_MARK internal fns.  */
  if (gimplify_omp_ctxp)
return;
in asan_poison_variable.  Not really sure why exactly it has been added, but if
we can't emit the ASAN_UNPOISON, we can't emit the corresponding ASAN_POISON
either.

So something like:
--- gcc/gimplify.c.jj   2018-03-16 13:43:14.831910333 +0100
+++ gcc/gimplify.c  2018-03-27 20:11:27.680195380 +0200
@@ -1689,7 +1689,8 @@ gimplify_decl_expr (tree *stmt_p, gimple
  && !TREE_STATIC (decl)
  && !DECL_HAS_VALUE_EXPR_P (decl)
  && DECL_ALIGN (decl) <= MAX_SUPPORTED_STACK_ALIGNMENT
- && dbg_cnt (asan_use_after_scope))
+ && dbg_cnt (asan_use_after_scope)
+ && !gimplify_omp_ctxp)
{
  asan_poisoned_variables->add (decl);
  asan_poison_variable (decl, false, seq_p);
@@ -6614,7 +6615,8 @@ gimplify_target_expr (tree *expr_p, gimp
}
  if (asan_poisoned_variables
  && DECL_ALIGN (temp) <= MAX_SUPPORTED_STACK_ALIGNMENT
- && dbg_cnt (asan_use_after_scope))
+ && dbg_cnt (asan_use_after_scope)
+ && !gimplify_omp_ctxp)
{
  tree asan_cleanup = build_asan_poison_call_expr (temp);
  if (asan_cleanup)

fixes it from me, but not really sure about the reasons why the above check is
in there.  Martin?

[Bug sanitizer/85081] [7/8 Regression] Sanitizer error with references in vectorized/parallel for-loop

2018-03-27 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85081

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |7.4