From: Jakub Jelinek Date: Thu, 8 Apr 2010 09:16:28 +0000 (+0200) Subject: re PR debug/43670 ("-fcompare-debug failure (length)" with -O -ftree-vrp) X-Git-Tag: releases/gcc-4.6.0~8011 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=aa847cc8ec88e3eb7f6671ad9ea1988ae3d7edbf;p=thirdparty%2Fgcc.git re PR debug/43670 ("-fcompare-debug failure (length)" with -O -ftree-vrp) PR debug/43670 * cfgexpand.c (expand_debug_expr): If for non-NULL offset op0 is not a MEM, just return NULL instead of assertion failure. (discover_nonconstant_array_refs): Don't walk debug stmts. * gcc.dg/pr43670.c: New test. From-SVN: r158108 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4eae83ac74a2..7e08006de17d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2010-04-08 Jakub Jelinek + + PR debug/43670 + * cfgexpand.c (expand_debug_expr): If for non-NULL offset + op0 is not a MEM, just return NULL instead of assertion + failure. + (discover_nonconstant_array_refs): Don't walk debug stmts. + 2010-04-08 Doug Kwan * configure.ac: Recognize gold and do not use its version number diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index eeb5c739b787..bff48973d5bd 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -2502,7 +2502,8 @@ expand_debug_expr (tree exp) { enum machine_mode addrmode, offmode; - gcc_assert (MEM_P (op0)); + if (!MEM_P (op0)) + return NULL; op0 = XEXP (op0, 0); addrmode = GET_MODE (op0); @@ -3623,7 +3624,8 @@ discover_nonconstant_array_refs (void) for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) { gimple stmt = gsi_stmt (gsi); - walk_gimple_op (stmt, discover_nonconstant_array_refs_r, NULL); + if (!is_gimple_debug (stmt)) + walk_gimple_op (stmt, discover_nonconstant_array_refs_r, NULL); } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 30ee707c3d3f..39fb6f024661 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-04-08 Jakub Jelinek + + PR debug/43670 + * gcc.dg/pr43670.c: New test. + 2010-04-08 Maxim Kuvyrkov PR middle-end/40815 diff --git a/gcc/testsuite/gcc.dg/pr43670.c b/gcc/testsuite/gcc.dg/pr43670.c new file mode 100644 index 000000000000..f152b4d7a639 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr43670.c @@ -0,0 +1,29 @@ +/* PR debug/43670 */ +/* { dg-do compile } */ +/* { dg-options "-O -ftree-vrp -fcompare-debug" } */ + +extern void abort (void); + +typedef struct { double T1; } S; + +void +foo (void) +{ + int i, j; + double s; + + S y[2][2]; + S *x[2] = { y[0], y[1] }; + S **p = x; + + for (i = 0; i < 2; i++) + for (j = 0; j < 2; j++) + p[j][i].T1 = 1; + + for (i = 0; i < 2; i++) + for (j = 0; j < 2; j++) + s = p[j][i].T1; + + if (s != 1) + abort (); +}