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

            Bug ID: 92377
           Summary: [7/8 Regression] ICE: Segmentation fault
           Product: gcc
           Version: 8.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: anbu1024.me at gmail dot com
  Target Milestone: ---

$ cat test.c 

int foo ( void ) ; 

int __attribute__ ( ( returns_twice ) ) bar ( void ) ; 

void baz ( ) 
{ 
    int x ; 
    if ( x > 10 ) 
        exit ( 0 ) ; 
    return 0 ;
    x = foo() + (bar() + 1); 
}


$ gcc-snapshot8 -v
Using built-in specs.
COLLECT_GCC=/home/tom/Documents/gcc/8-20191101/install/bin/gcc
COLLECT_LTO_WRAPPER=/home/tom/Documents/gcc/8-20191101/install/libexec/gcc/x86_64-pc-linux-gnu/8.3.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-8-20191101/configure
--prefix=/home/tom/Documents/gcc/8-20191101/install --enable-languages=c,c++
--disable-multilib
Thread model: posix
gcc version 8.3.1 20191101 (GCC) 


$ gcc-snapshot8 test.c 
test.c: In function ‘baz’:
test.c:10:9: warning: implicit declaration of function ‘exit’
[-Wimplicit-function-declaration]
         exit ( 0 ) ;
         ^~~~
test.c:10:9: warning: incompatible implicit declaration of built-in function
‘exit’
test.c:10:9: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
test.c:1:1:
+#include <stdlib.h>

test.c:10:9:
         exit ( 0 ) ;
         ^~~~
test.c:11:12: warning: ‘return’ with a value, in function returning void
     return 0 ;
            ^
test.c:6:6: note: declared here
 void baz ( )
      ^~~
during RTL pass: expand
test.c:12:7: internal compiler error: Segmentation fault
     x = foo() + (bar() + 1);
     ~~^~~~~~~~~~~~~~~~~~~~~
0xa6512f crash_signal
        ../../gcc-8-20191101/gcc/toplev.c:325
0x7d6d19 expand_expr_real_2(separate_ops*, rtx_def*, machine_mode,
expand_modifier)
        ../../gcc-8-20191101/gcc/expr.c:8653
0x6d93e2 expand_gimple_stmt_1
        ../../gcc-8-20191101/gcc/cfgexpand.c:3743
0x6d93e2 expand_gimple_stmt
        ../../gcc-8-20191101/gcc/cfgexpand.c:3804
0x6daf1f expand_gimple_basic_block
        ../../gcc-8-20191101/gcc/cfgexpand.c:5837
0x6e0446 execute
        ../../gcc-8-20191101/gcc/cfgexpand.c:6443
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.


$ gcc-snapshot7 -v
Using built-in specs.
COLLECT_GCC=/home/tom/Documents/gcc/7-20191031/install/bin/gcc
COLLECT_LTO_WRAPPER=/home/tom/Documents/gcc/7-20191031/install/libexec/gcc/x86_64-pc-linux-gnu/7.4.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-7-20191031/configure
--prefix=/home/tom/Documents/gcc/7-20191031/install --enable-languages=c,c++
--disable-multilib
Thread model: posix
gcc version 7.4.1 20191031 (GCC) 


$ gcc-snapshot7 test.c 
test.c: In function ‘baz’:
test.c:10:9: warning: implicit declaration of function ‘exit’
[-Wimplicit-function-declaration]
         exit ( 0 ) ;
         ^~~~
test.c:10:9: warning: incompatible implicit declaration of built-in function
‘exit’
test.c:10:9: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
test.c:11:12: warning: ‘return’ with a value, in function returning void
     return 0 ;
            ^
test.c:6:6: note: declared here
 void baz ( )
      ^~~
test.c:12:7: internal compiler error: Segmentation fault
     x = foo() + (bar() + 1);
     ~~^~~~~~~~~~~~~~~~~~~~~
0xa13c6f crash_signal
        ../../gcc-7-20191031/gcc/toplev.c:337
0x79f2e4 expand_expr_real_2(separate_ops*, rtx_def*, machine_mode,
expand_modifier)
        ../../gcc-7-20191031/gcc/expr.c:8526
0x6ae915 expand_gimple_stmt_1
        ../../gcc-7-20191031/gcc/cfgexpand.c:3676
0x6ae915 expand_gimple_stmt
        ../../gcc-7-20191031/gcc/cfgexpand.c:3737
0x6af83f expand_gimple_basic_block
        ../../gcc-7-20191031/gcc/cfgexpand.c:5744
0x6b4976 execute
        ../../gcc-7-20191031/gcc/cfgexpand.c:6357
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.



But if I use gcc-6.5 or gcc-5.5 to compile it, there is no ICE.

Reply via email to