Bug 53174

Summary: [4.6 Regression] ICE in expand_debug_expr, verify_ssa failed
Product: gcc Reporter: Paulo César Pereira de Andrade <pcpa>
Component: debugAssignee: Jakub Jelinek <jakub>
Status: RESOLVED FIXED    
Severity: normal CC: jakub
Priority: P3 Keywords: ice-checking
Version: 4.7.0   
Target Milestone: 4.6.4   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed: 2012-05-01 00:00:00
Attachments: ICE test case
gcc48-pr53174.patch

Description Paulo César Pereira de Andrade 2012-04-30 20:29:28 UTC
Created attachment 27271 [details]
ICE test case

I verified the problem happens in i586 with gcc 4.6.3,
x86_64 with gcc 4.6.1, 4.6.3 and a 4.7.0 snapshot.

The minimum set of options to cause the ICE is

g++  -c test.cc -O3 -g -ffast-math

changing either does not cause the crash.

backtrace in 4.6 looks like:
0x0000000000603185 in expand_debug_expr (exp=0x7ffff57dd790)
    at ../../gcc/cfgexpand.c:2380
2380      enum machine_mode mode = TYPE_MODE (TREE_TYPE (exp));

and in 4.7:
0x000000000064bc1c in expand_debug_expr (exp=0x7ffff4a3a730)
    at ../../gcc/cfgexpand.c:2615
2615      enum machine_mode mode = TYPE_MODE (TREE_TYPE (exp));

The testcase is adapted from demosaic_algos.cc from the
package from http://www.rawtherapee.com/
Comment 1 H.J. Lu 2012-05-01 00:53:34 UTC
It is very likely caused by tree-predcom.c change in revision 170050:

http://gcc.gnu.org/ml/gcc-cvs/2011-02/msg00595.html
Comment 2 Richard Biener 2012-05-02 10:30:34 UTC
Confirmed.

t.c: In function 'void RawImageSource(float (*)[4], int, int)':
t.c:19:6: error: definition in block 16 follows the use
for SSA_NAME: predreastmp.41_lsm0.63_20 in statement:
# DEBUG r1 => predreastmp.41_lsm0.63_20
t.c:19:6: internal compiler error: verify_ssa failed
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
Comment 3 Jakub Jelinek 2012-05-02 11:42:27 UTC
Created attachment 27286 [details]
gcc48-pr53174.patch

Untested fix.
Comment 4 Paulo César Pereira de Andrade 2012-05-02 14:08:02 UTC
(In reply to comment #3)
> Created attachment 27286 [details]
> gcc48-pr53174.patch
> 
> Untested fix.

Thanks. The patch corrects the ICE and builds the package.
Comment 5 Jakub Jelinek 2012-05-03 10:18:39 UTC
Author: jakub
Date: Thu May  3 10:18:34 2012
New Revision: 187087

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=187087
Log:
	PR debug/53174
	* tree-predcom.c (remove_stmt): Call reset_debug_uses on stmts being
	removed.

	* gcc.dg/pr53174.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/pr53174.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-predcom.c
Comment 6 Jakub Jelinek 2012-05-03 10:19:32 UTC
Author: jakub
Date: Thu May  3 10:19:29 2012
New Revision: 187088

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=187088
Log:
	PR debug/53174
	* tree-predcom.c (remove_stmt): Call reset_debug_uses on stmts being
	removed.

	* gcc.dg/pr53174.c: New test.

Added:
    branches/gcc-4_7-branch/gcc/testsuite/gcc.dg/pr53174.c
Modified:
    branches/gcc-4_7-branch/gcc/ChangeLog
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_7-branch/gcc/tree-predcom.c
Comment 7 Jakub Jelinek 2012-05-03 10:29:26 UTC
Fixed for 4.7+ so far.
Comment 8 Jakub Jelinek 2013-04-03 18:16:58 UTC
Author: jakub
Date: Wed Apr  3 17:54:23 2013
New Revision: 197442

URL: http://gcc.gnu.org/viewcvs?rev=197442&root=gcc&view=rev
Log:
	Backported from mainline
	2012-05-03  Jakub Jelinek  <jakub@redhat.com>
 
	PR debug/53174
	* tree-predcom.c (remove_stmt): Call reset_debug_uses on stmts being
	removed.

	* gcc.dg/pr53174.c: New test.

Added:
    branches/gcc-4_6-branch/gcc/testsuite/gcc.dg/pr53174.c
Modified:
    branches/gcc-4_6-branch/gcc/ChangeLog
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_6-branch/gcc/tree-predcom.c