https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69579

            Bug ID: 69579
           Summary: gcc ICE at -O3 on x86_64-linux-gnu with “tree check:
                    expected ssa_name, have integer_cst in
                    compute_optimized_partition_bases”
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: helloqirun at gmail dot com
  Target Milestone: ---

The following valid code causes an ICE when compiled with the current gcc trunk
at only -O3 on x86_64-linux-gnu in both 32-bit and 64-bit modes.

It might be a 4.9 regression.


$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/home/absozero/trunk/root-gcc/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/home/absozero/trunk/root-gcc
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 6.0.0 20160131 (experimental) [trunk revision 233019] (GCC)


$ gcc-trunk abc.c -O3
abc.c: In function 'fun2':
abc.c:7:5: warning: implicit declaration of function '__sigsetjmp'
[-Wimplicit-function-declaration]
     __sigsetjmp();
     ^~~~~~~~~~~
abc.c:4:5: internal compiler error: tree check: expected ssa_name, have
integer_cst in compute_optimized_partition_bases, at tree-ssa-coalesce.c:1572
 int fun2(struct str *p1) {
     ^~~~
0xdda56c tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ../../gcc/gcc/tree.c:9637
0xc6a97e tree_check(tree_node*, char const*, int, char const*, tree_code)
        ../../gcc/gcc/tree.h:3006
0xc6a97e compute_optimized_partition_bases
        ../../gcc/gcc/tree-ssa-coalesce.c:1572
0xc6bed7 coalesce_ssa_name()
        ../../gcc/gcc/tree-ssa-coalesce.c:1779
0xc027f0 remove_ssa_form
        ../../gcc/gcc/tree-outof-ssa.c:974
0xc027f0 rewrite_out_of_ssa(ssaexpand*)
        ../../gcc/gcc/tree-outof-ssa.c:1198
0x753560 execute
        ../../gcc/gcc/cfgexpand.c:6124
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.



$ cat abc.c
struct str {
  int Count;
};
int fun2(struct str *p1) {
  int i = 1;
  while (1) {
    __sigsetjmp();
    break;
  }
  for (; i;) {
    i = 0;
    for (; i < (p1 ? p1->Count : 1); i++)
      fun2(p1);
  }
  return 1;
}

Reply via email to