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

            Bug ID: 71503
           Summary: gcc ICE at -O3 on valid code on x86_64-linux-gnu in
                    "gen_phi_arg_condition"
           Product: gcc
           Version: 7.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- and 64-bit modes. 

It appears to be a 7 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/7.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 7.0.0 20160611 (experimental) [trunk revision 237328] (GCC)



$ gcc-trunk -O3 abc.c
abc.c: In function ‘fn1’:
abc.c:3:6: internal compiler error: in gen_phi_arg_condition, at
tree-if-conv.c:1705
 void fn1() {
      ^~~
0xbd09a9 gen_phi_arg_condition
        ../../gcc/gcc/tree-if-conv.c:1705
0xbd09a9 predicate_scalar_phi
        ../../gcc/gcc/tree-if-conv.c:1901
0xbd0db0 predicate_all_scalar_phis
        ../../gcc/gcc/tree-if-conv.c:1946
0xbd0db0 combine_blocks
        ../../gcc/gcc/tree-if-conv.c:2301
0xbd49d6 tree_if_conversion
        ../../gcc/gcc/tree-if-conv.c:2663
0xbd49d6 execute
        ../../gcc/gcc/tree-if-conv.c:2749
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
int a, b;
unsigned long d;
void fn1() {
  unsigned long *h = &d;
line1 : {
  int i = 4;
  for (; b; i++) {
    d = ((d + 6 ?: *h) ? a : 7) && (i &= 0 >= b);
    b += a;
  }
}
  h = 0;
  for (; *h;)
    goto line1;
}

Reply via email to