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

            Bug ID: 67133
           Summary: ICE at -Os and above on x86_64-linux-gnu in gimple_op,
                    at gimple.h:2274
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu
  Target Milestone: ---

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

It is a regression from 5.1.x. 


$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/usr/local/gcc-trunk
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 6.0.0 20150805 (experimental) [trunk revision 226646] (GCC)
$
$ gcc-trunk -O1 -c small.c
$ gcc-5.1 -Os -c small.c
$
$ gcc-trunk -Os -c small.c
small.c: In function ‘fn3’:
small.c:29:1: internal compiler error: in gimple_op, at gimple.h:2274
 fn3 ()
 ^
0x86e15d gimple_op
        ../../gcc-trunk/gcc/gimple.h:2274
0x86e15d gimple_call_arg
        ../../gcc-trunk/gcc/gimple.h:2861
0x86e15d infer_nonnull_range_by_attribute(gimple_statement_base*, tree_node*)
        ../../gcc-trunk/gcc/gimple.c:2681
0x10c96f6 find_explicit_erroneous_behaviour
        ../../gcc-trunk/gcc/gimple-ssa-isolate-paths.c:410
0x10c96f6 gimple_ssa_isolate_erroneous_paths
        ../../gcc-trunk/gcc/gimple-ssa-isolate-paths.c:526
0x10c96f6 execute
        ../../gcc-trunk/gcc/gimple-ssa-isolate-paths.c:577
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.
$


-----------------------------------


#include <assert.h>

int printf (const char *, ...);

int a, *b, c;

static int
fn1 ()
{ 
  if (a)
    return (a = 0);
  for (; a; )
    a = 0;
  return 0;
}

static int
fn2 (int p)
{ 
  fn1 ();
  c = 0;
  if (p)
    printf ("%d", 0);
  assert (b != &p);
  return 0;
}

void
fn3 ()
{ 
  fn2 (0);
}

Reply via email to