From 15a54c10cb41f5a84583f7359c347706a6b90c5d Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Fri, 3 Sep 2010 14:42:46 +0000 Subject: [PATCH] re PR middle-end/45415 (ICE in partition_view_bitmap, at tree-ssa-live.c:334) PR middle-end/45415 * tree-sra.c (sra_modify_assign): If we modify the statement, say so. * tree-ssa.c (verify_ssa): Check number of operands and links per statement to agree. testsuite/ PR middle-end/45415 * gcc.dg/pr45415.c: New test. From-SVN: r163822 --- gcc/ChangeLog | 9 +++++ gcc/testsuite/ChangeLog | 5 +++ gcc/testsuite/gcc.dg/pr45415.c | 68 ++++++++++++++++++++++++++++++++++ gcc/tree-sra.c | 1 + gcc/tree-ssa.c | 16 ++++++++ 5 files changed, 99 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr45415.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2a2d82d9a8f..fafdbabb398 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2010-09-03 Michael Matz + + PR middle-end/45415 + * tree-sra.c (sra_modify_assign): If we modify the statement, + say so. + + * tree-ssa.c (verify_ssa): Check number of operands and links + per statement to agree. + 2010-09-03 Uros Bizjak Iain Sandoe diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 677202011b9..3cdb32f4208 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-09-03 Michael Matz + + PR middle-end/45415 + * gcc.dg/pr45415.c: New test. + 2010-09-03 H.J. Lu PR tree-optimization/45506 diff --git a/gcc/testsuite/gcc.dg/pr45415.c b/gcc/testsuite/gcc.dg/pr45415.c new file mode 100644 index 00000000000..12d9fc0f5a1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr45415.c @@ -0,0 +1,68 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fno-tree-dominator-opts" } */ + +typedef unsigned long int st; +typedef unsigned long long dt; +typedef union +{ + dt d; + struct + { + st h, l; + } + s; +} t_be; + +typedef union +{ + dt d; + struct + { + st l, h; + } + s; +} t_le; + +#define df(f, t) \ +int \ +f (t afh, t bfh) \ +{ \ + t hh; \ + t hp, lp, dp, m; \ + st ad, bd; \ + int s; \ + s = 0; \ + ad = afh.s.h - afh.s.l; \ + bd = bfh.s.l - bfh.s.h; \ + if (bd > bfh.s.l) \ + { \ + bd = -bd; \ + s = ~s; \ + } \ + lp.d = (dt) afh.s.l * bfh.s.l; \ + hp.d = (dt) afh.s.h * bfh.s.h; \ + dp.d = (dt) ad *bd; \ + dp.d ^= s; \ + hh.d = hp.d + hp.s.h + lp.s.h + dp.s.h; \ + m.d = (dt) lp.s.h + hp.s.l + lp.s.l + dp.s.l; \ + return hh.s.l + m.s.l; \ +} + +df(f_le, t_le) +df(f_be, t_be) + +void abort (void); +void exit (int); +main () +{ + t_be x; + x.s.h = 0x10000000U; + x.s.l = 0xe0000000U; + if (x.d == 0x10000000e0000000ULL + && f_be ((t_be) 0x100000000ULL, (t_be) 0x100000000ULL) != -1) + abort (); + if (x.d == 0xe000000010000000ULL + && f_le ((t_le) 0x100000000ULL, (t_le) 0x100000000ULL) != -1) + abort (); + exit (0); +} diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 83d2d277c5b..75e7682fcac 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -2783,6 +2783,7 @@ sra_modify_assign (gimple *stmt, gimple_stmt_iterator *gsi) true, GSI_SAME_STMT); if (gimple_assign_rhs1 (*stmt) != rhs) { + modify_this_stmt = true; gimple_assign_set_rhs_from_tree (&orig_gsi, rhs); gcc_assert (*stmt == gsi_stmt (orig_gsi)); } diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 16f85f5d868..9202f049670 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -938,6 +938,8 @@ verify_ssa (bool check_modified_stmt) gimple stmt = gsi_stmt (gsi); use_operand_p use_p; bool has_err; + int count; + unsigned i; if (check_modified_stmt && gimple_modified_p (stmt)) { @@ -1007,6 +1009,7 @@ verify_ssa (bool check_modified_stmt) goto err; } + count = 0; FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_USE|SSA_OP_DEF) { if (verify_ssa_name (op, false)) @@ -1015,6 +1018,19 @@ verify_ssa (bool check_modified_stmt) print_gimple_stmt (stderr, stmt, 0, TDF_VOPS|TDF_MEMSYMS); goto err; } + count++; + } + + for (i = 0; i < gimple_num_ops (stmt); i++) + { + op = gimple_op (stmt, i); + if (op && TREE_CODE (op) == SSA_NAME && --count < 0) + { + error ("nr of operands and imm-links doesn't agree"); + error ("in statement"); + print_gimple_stmt (stderr, stmt, 0, TDF_VOPS|TDF_MEMSYMS); + goto err; + } } FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_USE|SSA_OP_VUSE) -- 2.30.2