[Bug debug/71432] [7 Regression] -fcompare-debug failure (length)

2016-06-09 Thread bernds at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71432

Bernd Schmidt  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |FIXED

--- Comment #7 from Bernd Schmidt  ---
Fixed.

[Bug debug/71432] [7 Regression] -fcompare-debug failure (length)

2016-06-08 Thread bernds at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71432

--- Comment #6 from Bernd Schmidt  ---
Author: bernds
Date: Wed Jun  8 11:41:54 2016
New Revision: 237208

URL: https://gcc.gnu.org/viewcvs?rev=237208=gcc=rev
Log:
PR debug/71432
PR ada/71413
* tree-ssa-strlen.c (handle_builtin_memcmp): Ignore debug insns.

* g++.dg/debug/pr71432.C: New test.


Added:
trunk/gcc/testsuite/g++.dg/debug/pr71432.C
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-strlen.c

[Bug debug/71432] [7 Regression] -fcompare-debug failure (length)

2016-06-07 Thread burnus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71432

--- Comment #5 from Tobias Burnus  ---
(In reply to Bernd Schmidt from comment #4)
> Most likely a dup of bug 71413.

Likely as the suggested patch is effectively the same. This one comes with test
case, consider to include it in the final patch.

[Bug debug/71432] [7 Regression] -fcompare-debug failure (length)

2016-06-07 Thread bernds at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71432

--- Comment #4 from Bernd Schmidt  ---
Most likely a dup of 71413.

[Bug debug/71432] [7 Regression] -fcompare-debug failure (length)

2016-06-07 Thread burnus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71432

--- Comment #3 from Tobias Burnus  ---
The code in handle_builtin_memcmp looks as follows:


  FOR_EACH_IMM_USE_FAST (use_p, iter, res)
{
  gimple *ustmt = USE_STMT (use_p);
  if (gimple_code (ustmt) == GIMPLE_ASSIGN)
...
  else if (gimple_code (ustmt) == GIMPLE_COND)
...
  else
return true;
}

Note the "else return true;". I wonder whether it should be removed for good -
or whether it makes indeed sense to abort with "true" after the first loop
iteration.

In any case, with debug symbols, I get a bunch of GIMPLE_DEBUG statements
before the the GIMPLE_COND. Hence, the debug compare issue is fixed by the
following patch:

diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c
index 5e2d7db..bb90339 100644
--- a/gcc/tree-ssa-strlen.c
+++ b/gcc/tree-ssa-strlen.c
@@ -1883,5 +1883,5 @@ handle_builtin_memcmp (gimple_stmt_iterator *gsi)
return true;
}
-  else
+  else if (gimple_code (ustmt) != GIMPLE_DEBUG)
return true;
 }

[Bug debug/71432] [7 Regression] -fcompare-debug failure (length)

2016-06-07 Thread burnus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71432

--- Comment #2 from Tobias Burnus  ---
The difference between the two insns-dumps is the "_eq":

0:   extern int __builtin_memcmp_eq (const void *, const void *, long unsigned
int);

vs.

0:   extern int __builtin_memcmp (const void *, const void *, long unsigned
int);

[Bug debug/71432] [7 Regression] -fcompare-debug failure (length)

2016-06-06 Thread burnus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71432

Tobias Burnus  changed:

   What|Removed |Added

 CC||bernds at gcc dot gnu.org
   Target Milestone|--- |7.0

--- Comment #1 from Tobias Burnus  ---
Bisecting points at r237069:

2016-06-03  Bernd Schmidt  
PR tree-optimization/52171
[...]

Disclaimer: As I was partially doing incremental builds, the bisection might
have gone wrong.