[Bug sanitizer/78832] [7 Regression] -fcompare-debug failure (length) with -fsanitize=address

2016-12-17 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78832

Jakub Jelinek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #4 from Jakub Jelinek  ---
Fixed.

[Bug sanitizer/78832] [7 Regression] -fcompare-debug failure (length) with -fsanitize=address

2016-12-17 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78832

--- Comment #3 from Jakub Jelinek  ---
Author: jakub
Date: Sat Dec 17 19:10:39 2016
New Revision: 243777

URL: https://gcc.gnu.org/viewcvs?rev=243777=gcc=rev
Log:
PR sanitizer/78832
* sanopt.c (sanitize_asan_mark_unpoison): Remove next variable, use
continue if gsi_next should be skipped.
(sanitize_asan_mark_poison): Remove prev variable, use continue if
gsi_prev should be skipped.  When removing ASAN_MARK, do gsi_prev
first and gsi_remove on a previously made copy of the iterator.

* gcc.dg/asan/pr78832.c: New test.

Added:
trunk/gcc/testsuite/gcc.dg/asan/pr78832.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/sanopt.c
trunk/gcc/testsuite/ChangeLog

[Bug sanitizer/78832] [7 Regression] -fcompare-debug failure (length) with -fsanitize=address

2016-12-16 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78832

--- Comment #2 from Jakub Jelinek  ---
Created attachment 40351
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40351=edit
gcc7-pr78832.patch

Untested fix.  I'm sure this started with r243611.

The problem is that gsi_remove updates gsi to the next statement, not previous
as would be needed in this case.  If removing the last stmt in a bb, that means
it will be the only removed stmt from that bb (which is wrong), if there is
some stmt after it, it will just process it twice (which shouldn't have any
visible effect).  Now, the -fcompare-debug failure is if the bb with -g ends
with debug stmt(s), and before that there is ASAN_MARK (POISON, ) and before
that at least another one without a call or ASAN_CHECK or asm in between.

[Bug sanitizer/78832] [7 Regression] -fcompare-debug failure (length) with -fsanitize=address

2016-12-16 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78832

Jakub Jelinek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2016-12-16
   Assignee|unassigned at gcc dot gnu.org  |jakub at gcc dot gnu.org
   Target Milestone|--- |7.0
 Ever confirmed|0   |1

--- Comment #1 from Jakub Jelinek  ---
I'll take this.