From: Vladimir Makarov Date: Thu, 10 Dec 2015 18:00:47 +0000 (+0000) Subject: re PR rtl-optimization/68691 (ICE at -O3 with -g enabled on x86_64-linux-gnu in alter... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=684ffdc9af5298cf63c26697d4a4df7688e9e09b;p=gcc.git re PR rtl-optimization/68691 (ICE at -O3 with -g enabled on x86_64-linux-gnu in alter_subregs, at lra-spills.c:610 (in 32-bit mode)) 2015-12-10 Vladimir Makarov PR rtl-optimization/68691 * lra-spills.c (lra_final_code_change): Check pseudo occurrence number in non-debug insns and remove debug insns if necessary. 2015-12-10 Vladimir Makarov PR rtl-optimization/68691 * gcc.target/i386/pr68691.c: New. From-SVN: r231538 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2eb367a9a15..c8522ddc2a8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-12-10 Vladimir Makarov + + PR rtl-optimization/68691 + * lra-spills.c (lra_final_code_change): Check pseudo occurrence + number in non-debug insns and remove debug insns if necessary. + 2015-12-10 Martin Sebor * invoke.texi (Warning Options): Update -Wall options. Clarify diff --git a/gcc/lra-spills.c b/gcc/lra-spills.c index e469a84ba5b..6dacb799e4b 100644 --- a/gcc/lra-spills.c +++ b/gcc/lra-spills.c @@ -708,6 +708,30 @@ lra_final_code_change (void) } lra_insn_recog_data_t id = lra_get_insn_recog_data (insn); + struct lra_insn_reg *reg; + + for (reg = id->regs; reg != NULL; reg = reg->next) + if (reg->regno >= FIRST_PSEUDO_REGISTER + && lra_reg_info [reg->regno].nrefs == 0) + break; + + if (reg != NULL) + { + /* Pseudos still can be in debug insns in some very rare + and complicated cases, e.g. the pseudo was removed by + inheritance and the debug insn is not EBBs where the + inheritance happened. It is difficult and time + consuming to find what hard register corresponds the + pseudo -- so just remove the debug insn. Another + solution could be assigning hard reg/memory but it + would be a misleading info. It is better not to have + info than have it wrong. */ + lra_assert (DEBUG_INSN_P (insn)); + lra_invalidate_insn_data (insn); + delete_insn (insn); + continue; + } + struct lra_static_insn_data *static_id = id->insn_static_data; bool insn_change_p = false; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bc79f6fe7a6..fec376037d0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-12-10 Vladimir Makarov + + PR rtl-optimization/68691 + * gcc.target/i386/pr68691.c: New. + 2015-12-10 David Malcolm * lib/multiline.exp (_multiline_expected_outputs): Update comment. diff --git a/gcc/testsuite/gcc.target/i386/pr68691.c b/gcc/testsuite/gcc.target/i386/pr68691.c new file mode 100644 index 00000000000..f522291454c --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr68691.c @@ -0,0 +1,42 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -g" } */ + +char a, b, i, j; +int c, d, e, f, g, h, n; + +char +fn1 () +{ + char k, l, m; + int p; + e = g > f; + for (b = 0; b < 2; b++) + { + for (p = 0; p < 3; p++) + { + for (; h < 1; h++) + { + for (; m;) + goto lbl; + e = g; + } + l = a < 0 || a < d; + } + d++; + for (;;) + { + k = g; + n = -k; + j = n; + c = j; + e = 2; + if (l) + break; + return 2; + } + } + for (;;) + ; + lbl: + return i; +}