http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58346

            Bug ID: 58346
           Summary: ICE with SIGFPE at -O1 and above on x86_64-linux-gnu
                    (affecting trunk, 4.8, 4.7, and 4.6)
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu

The following code causes an ICE when compiled with the current gcc trunk, 4.8,
and 4.7 at -O1 and above (at only -O1 for 4.6) on x86_64-linux (both 32-bit and
64-bit modes). 

This should be related to 58345 (the backtraces are almost identical), but
affects also 4.6 and 4.7 as well as more optimization levels. 


$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-trunk/configure
--enable-languages=c,c++,objc,obj-c++,fortran,lto
--with-gmp=/usr/local/gcc-trunk --with-mpfr=/usr/local/gcc-trunk
--with-mpc=/usr/local/gcc-trunk --with-cloog=/usr/local/gcc-trunk
--prefix=/usr/local/gcc-trunk
Thread model: posix
gcc version 4.9.0 20130906 (experimental) [trunk revision 202308] (GCC) 
$ gcc-trunk -O0 -c small.c
$ gcc-trunk -O1 -c small.c
small.c: In function ‘main’:
small.c:20:5: internal compiler error: Floating point exception
 int main ()
     ^
0x924b2f crash_signal
    ../../gcc-trunk/gcc/toplev.c:335
0x77ecd3 fold_array_ctor_reference
    ../../gcc-trunk/gcc/gimple-fold.c:2816
0x77ecd3 fold_ctor_reference
    ../../gcc-trunk/gcc/gimple-fold.c:2964
0x7827d2 fold_const_aggregate_ref_1(tree_node*, tree_node* (*)(tree_node*))
    ../../gcc-trunk/gcc/gimple-fold.c:3066
0x78443b fold_const_aggregate_ref
    ../../gcc-trunk/gcc/gimple-fold.c:3088
0x78443b maybe_fold_reference
    ../../gcc-trunk/gcc/gimple-fold.c:272
0x784df6 gimple_fold_call
    ../../gcc-trunk/gcc/gimple-fold.c:1091
0x784df6 fold_stmt_1
    ../../gcc-trunk/gcc/gimple-fold.c:1200
0x9763c9 fold_marked_statements
    ../../gcc-trunk/gcc/tree-inline.c:4380
0x983404 optimize_inline_calls(tree_node*)
    ../../gcc-trunk/gcc/tree-inline.c:4475
0xd85fa3 inline_transform(cgraph_node*)
    ../../gcc-trunk/gcc/ipa-inline-transform.c:436
0x880e6f execute_one_ipa_transform_pass
    ../../gcc-trunk/gcc/passes.c:2039
0x880e6f execute_all_ipa_transforms()
    ../../gcc-trunk/gcc/passes.c:2079
0x636160 expand_function
    ../../gcc-trunk/gcc/cgraphunit.c:1702
0x63809d expand_all_functions
    ../../gcc-trunk/gcc/cgraphunit.c:1814
0x63809d compile()
    ../../gcc-trunk/gcc/cgraphunit.c:2151
0x638729 finalize_compilation_unit()
    ../../gcc-trunk/gcc/cgraphunit.c:2228
0x516813 c_write_global_declarations()
    ../../gcc-trunk/gcc/c/c-decl.c:10125
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.
$ 


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


struct U {};
static struct U b[1] = { };

int a, **c, d, *e, f;

extern void bar (int, int, int, struct U); 
extern void foobar (int, int, int); 
extern int baz (int, int); 

static void foo ()
{
  bar (d, 0, 0, b[0]);
  foobar (0 >= f, 0, 0);
  **c = 0 == a;
  baz (**c, 0);
  baz (0, *e);
  *e = baz (0, 0);
}

int main ()
{
  foo ();
  return 0;
}

Reply via email to