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

            Bug ID: 104764
           Summary: gcc hangs when compiling an invalid c program
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhenyang.xu at uwaterloo dot ca
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/home/xuzhy/usr/bin/libexec/gcc/x86_64-pc-linux-gnu/12.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.V0AGQ6q77G-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/home/xuzhy/usr/bin --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.1 20220302 (experimental) [master -g2f1fa70db] (GCC)

$ cat mutant.c
static a();
b(void) {sizeof ( int [ a}
static c();
d(void) {sizeof((int[c

$ timeout -s 9 30 gcc-trunk -O3 -g -Wall -Wextra -c mutant.c
mutant.c:1:8: warning: type defaults to 'int' in declaration of 'a'
[-Wimplicit-int]
    1 | static a();
      |        ^
mutant.c:2:1: warning: return type defaults to 'int' [-Wimplicit-int]
    2 | b(void) {sizeof ( int [ a}
      | ^
mutant.c: In function 'b':
mutant.c:2:26: error: expected ']' before '}' token
    2 | b(void) {sizeof ( int [ a}
      |                          ^
      |                          ]
mutant.c:2:26: error: expected ')' before '}' token
    2 | b(void) {sizeof ( int [ a}
      |                 ~        ^
      |                          )
mutant.c:2:26: error: expected ';' before '}' token
    2 | b(void) {sizeof ( int [ a}
      |                          ^
      |                          ;
mutant.c: At top level:
mutant.c:3:8: warning: type defaults to 'int' in declaration of 'c'
[-Wimplicit-int]
    3 | static c();
      |        ^
mutant.c:4:1: warning: return type defaults to 'int' [-Wimplicit-int]
    4 | d(void) {sizeof((int[c
      | ^
mutant.c: In function 'd':
mutant.c:4:23: error: expected ']' at end of input
    4 | d(void) {sizeof((int[c
      |                       ^
      |                       ]
[1]    338968 killed     timeout -s 9 30 gcc-trunk -O3 -g -Wall -Wextra -c
mutant.c
  • [Bug c/104764] New: gcc hangs... zhenyang.xu at uwaterloo dot ca via Gcc-bugs

Reply via email to