[regehr@imp test]$ gcc -O3 -c -Wall ./work20/reduce_55RZFl/small.c ./work20/reduce_55RZFl/small.c: In function âfn2â: ./work20/reduce_55RZFl/small.c:4:6: internal compiler error: in get_val_for, at tree-ssa-loop-niter.c:2267 void fn2() { ^ 0xafe7c9 get_val_for /users/regehr/z/compiler-source/gcc/gcc/tree-ssa-loop-niter.c:2267 0xb0162b loop_niter_by_eval(loop*, edge_def*) /users/regehr/z/compiler-source/gcc/gcc/tree-ssa-loop-niter.c:2335 0xb01934 find_loop_niter_by_eval(loop*, edge_def**) /users/regehr/z/compiler-source/gcc/gcc/tree-ssa-loop-niter.c:2394 0xae4c5f canonicalize_loop_induction_variables /users/regehr/z/compiler-source/gcc/gcc/tree-ssa-loop-ivcanon.c:929 0xae682b canonicalize_induction_variables() /users/regehr/z/compiler-source/gcc/gcc/tree-ssa-loop-ivcanon.c:998 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions. [regehr@imp test]$ cat ./work20/reduce_55RZFl/small.c int a, b, c, d, e; int fn1(p1, p2) { return p2 == 0 ? p1 : 1 % p2; } void fn2() { c = 0; for (;; c = (unsigned short)c) { b = 2; for (; b; b = a) { e = fn1(2, c && 1); d = c == 0 ? e : c; if (d) return; } } } [regehr@imp test]$ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/mnt/local/randomtest/compiler-install/gcc-r204770-install/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: /users/regehr/z/compiler-source/gcc/configure --prefix=/users/regehr/z/compiler-install/gcc-r204770-install --enable-languages=c,c++ --enable-multilib Thread model: posix gcc version 4.9.0 20131114 (experimental) (GCC)
Confirmed. (gdb) call debug_gimple_stmt (stmt)
Started with r173612.
I can't reproduce it anymore and wonder what fixed it. Likely some constant folding. I wonder if a more appropriate fix would be to drop the gcc_unreachable () and just fold the thing. I'll have a look.
Author: rguenth Date: Mon Dec 2 15:43:01 2013 New Revision: 205588 URL: http://gcc.gnu.org/viewcvs?rev=205588&root=gcc&view=rev Log: 2013-12-02 Richard Biener <rguenther@suse.de> PR tree-optimization/59139 * tree-ssa-loop-niter.c (chain_of_csts_start): Properly match code in get_val_for. (get_val_for): Use gcc_checking_asserts. * gcc.dg/torture/pr59139.c: New testcase. Added: trunk/gcc/testsuite/gcc.dg/torture/pr59139.c Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-ssa-loop-niter.c
Author: rguenth Date: Mon Dec 2 15:43:47 2013 New Revision: 205589 URL: http://gcc.gnu.org/viewcvs?rev=205589&root=gcc&view=rev Log: 2013-12-02 Richard Biener <rguenther@suse.de> PR tree-optimization/59139 * tree-ssa-loop-niter.c (chain_of_csts_start): Properly match code in get_val_for. (get_val_for): Use gcc_checking_asserts. * gcc.dg/torture/pr59139.c: New testcase. Added: branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/torture/pr59139.c Modified: branches/gcc-4_8-branch/gcc/ChangeLog branches/gcc-4_8-branch/gcc/testsuite/ChangeLog branches/gcc-4_8-branch/gcc/tree-ssa-loop-niter.c
Fixed for 4.8.3 sofar.
Author: rguenth Date: Mon Mar 17 14:38:55 2014 New Revision: 208618 URL: http://gcc.gnu.org/viewcvs?rev=208618&root=gcc&view=rev Log: 2014-03-17 Richard Biener <rguenther@suse.de> Backport from mainline 2013-05-21 Richard Biener <rguenther@suse.de> PR tree-optimization/57303 * tree-ssa-sink.c (statement_sink_location): Properly handle self-assignments. * gcc.dg/torture/pr57303.c: New testcase. 2013-12-02 Richard Biener <rguenther@suse.de> PR tree-optimization/59139 * tree-ssa-loop-niter.c (chain_of_csts_start): Properly match code in get_val_for. (get_val_for): Use gcc_checking_asserts. * gcc.dg/torture/pr59139.c: New testcase. 2014-02-14 Richard Biener <rguenther@suse.de> PR tree-optimization/60183 * tree-ssa-phiprop.c (propagate_with_phi): Avoid speculating loads. (tree_ssa_phiprop): Calculate and free post-dominators. * gcc.dg/torture/pr60183.c: New testcase. Added: branches/gcc-4_7-branch/gcc/testsuite/gcc.dg/torture/pr57303.c branches/gcc-4_7-branch/gcc/testsuite/gcc.dg/torture/pr59139.c branches/gcc-4_7-branch/gcc/testsuite/gcc.dg/torture/pr60183.c Modified: branches/gcc-4_7-branch/gcc/ChangeLog branches/gcc-4_7-branch/gcc/testsuite/ChangeLog branches/gcc-4_7-branch/gcc/tree-ssa-loop-niter.c branches/gcc-4_7-branch/gcc/tree-ssa-phiprop.c branches/gcc-4_7-branch/gcc/tree-ssa-sink.c
Fixed.