Bug 58522 - [4.9 Regression] ICE with segfault at -O3 on x86_64-linux-gnu
Summary: [4.9 Regression] ICE with segfault at -O3 on x86_64-linux-gnu
Status: RESOLVED DUPLICATE of bug 57393
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.9.0
: P3 normal
Target Milestone: 4.9.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-24 20:28 UTC by Zhendong Su
Modified: 2013-09-25 00:58 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Zhendong Su 2013-09-24 20:28:24 UTC
The following code causes an ICE when compiled with the current gcc trunk at -O3 on x86_64-linux in both 32-bit and 64-bit modes. 

This is a regression from 4.8.x. 


$ 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 --enable-checking=release --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 20130924 (experimental) [trunk revision 202859] (GCC) 
$ 
$ gcc-trunk -O2 small.c   
$ gcc-4.8 -O3 small.c  
$ gcc-trunk -O3 small.c
small.c: In function ‘main’:
small.c:13:1: internal compiler error: Segmentation fault
 main ()
 ^
0x8108ef crash_signal
	../../gcc-trunk/gcc/toplev.c:335
0x83b957 ssa_default_def(function*, tree_node*)
	../../gcc-trunk/gcc/tree-dfa.c:310
0x83bcc0 get_or_create_ssa_default_def(function*, tree_node*)
	../../gcc-trunk/gcc/tree-dfa.c:362
0x8569ec get_reaching_def
	../../gcc-trunk/gcc/tree-into-ssa.c:1184
0x85ca82 maybe_replace_use
	../../gcc-trunk/gcc/tree-into-ssa.c:1791
0x85ca82 rewrite_update_stmt
	../../gcc-trunk/gcc/tree-into-ssa.c:1974
0x85ca82 rewrite_update_dom_walker::before_dom_children(basic_block_def*)
	../../gcc-trunk/gcc/tree-into-ssa.c:2150
0xb99ed7 dom_walker::walk(basic_block_def*)
	../../gcc-trunk/gcc/domwalk.c:176
0x85560c rewrite_blocks
	../../gcc-trunk/gcc/tree-into-ssa.c:2209
0x85bce6 update_ssa(unsigned int)
	../../gcc-trunk/gcc/tree-into-ssa.c:3294
0x9826bd insert_range_assertions
	../../gcc-trunk/gcc/tree-vrp.c:6103
0x9826bd execute_vrp
	../../gcc-trunk/gcc/tree-vrp.c:9572
0x9826bd execute
	../../gcc-trunk/gcc/tree-vrp.c:9673
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.
$ 



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


static int a, b;
char *c;
short *d, e;
int f;

short
foo (int p1, int p2)
{
  return p2 >= 0 || p1 > 1 >> p2 ? p1 : p1 << p2;
}

int
main ()
{
  int *g = &f, h;
 
  for (b = 4; b; b--)
    {
      for (a = 0; a < 5; a++)
        {
	  e = foo (h != 0, *d);
	  *g |= e;
	  *d = 0;
        }
      *c = 0;
    }

  return 0;
}
Comment 1 Jakub Jelinek 2013-09-24 21:25:39 UTC
Started with r199048, so sounds like one of the many dups of the reassoc scheduling bugs.
Comment 2 Zhendong Su 2013-09-24 23:00:03 UTC
(In reply to Jakub Jelinek from comment #1)
> Started with r199048, so sounds like one of the many dups of the reassoc
> scheduling bugs.

Jakub, I think you are right. I somehow forgot to check it against the proposed patch for 57393, which makes this ICE disappear.
Comment 3 Zhendong Su 2013-09-25 00:58:51 UTC
Dup.

*** This bug has been marked as a duplicate of bug 57393 ***