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

            Bug ID: 92615
           Summary: [8/9/10 Regression] ICE in extract_insn
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: inline-asm
          Assignee: unassigned at gcc dot gnu.org
          Reporter: anbu1024.me at gmail dot com
  Target Milestone: ---

$ cat test.c 

void foo ( ) 
{ 
    char bar ;
    if ( bar ) 
    {
        volatile int * bar = & bar ; 
        __asm__ ( "cmp $1, %1" : "=@ccng" ( bar ) : "r" ( 1 ) ) ;
    }
}

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

$ gcc-snapshot10 --version
gcc (GCC) 10.0.0 20191117 (experimental)
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ gcc-snapshot10 test.c 
test.c: In function ‘foo’:
test.c:7:30: warning: initialization of ‘volatile int *’ from incompatible
pointer type ‘volatile int **’
[]8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wincompatible-pointer-types\-Wincompatible-pointer-types]8;;\]
    7 |         volatile int * bar = & bar ;
      |                              ^
test.c:10:1: error: unrecognizable insn:
   10 | }
      | ^
(insn 12 11 16 4 (set (mem/f/c:DI (plus:DI (reg/f:DI 77 virtual-stack-vars)
                (const_int -16 [0xfffffffffffffff0])) [1 bar+0 S8 A64])
        (zero_extend:DI (reg:QI 84))) "test.c":8:9 -1
     (nil))
during RTL pass: vregs
test.c:10:1: internal compiler error: in extract_insn, at recog.c:2311
0x6a08f8 _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
        ../../gcc-10-20191117/gcc/rtl-error.c:108
0x6a0914 _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
        ../../gcc-10-20191117/gcc/rtl-error.c:116
0x69ecfb extract_insn(rtx_insn*)
        ../../gcc-10-20191117/gcc/recog.c:2311
0xa73663 instantiate_virtual_regs_in_insn
        ../../gcc-10-20191117/gcc/function.c:1607
0xa73663 instantiate_virtual_regs
        ../../gcc-10-20191117/gcc/function.c:1977
0xa73663 execute
        ../../gcc-10-20191117/gcc/function.c:2026
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-snapshot9 --version
gcc (GCC) 9.2.1 20191116
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


$ gcc-snapshot9 test.c 
test.c: In function ‘foo’:
test.c:7:30: warning: initialization of ‘volatile int *’ from incompatible
pointer type ‘volatile int **’ [-Wincompatible-pointer-types]
    7 |         volatile int * bar = & bar ;
      |                              ^
test.c:10:1: error: unrecognizable insn:
   10 | }
      | ^
(insn 12 11 16 4 (set (mem/f/c:DI (plus:DI (reg/f:DI 77 virtual-stack-vars)
                (const_int -16 [0xfffffffffffffff0])) [1 bar+0 S8 A64])
        (zero_extend:DI (reg:QI 84))) "test.c":8:9 -1
     (nil))
during RTL pass: vregs
test.c:10:1: internal compiler error: in extract_insn, at recog.c:2310
0x5c27c3 _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
        ../../gcc-9-20191116/gcc/rtl-error.c:108
0x5c27df _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
        ../../gcc-9-20191116/gcc/rtl-error.c:116
0x5c18da extract_insn(rtx_insn*)
        ../../gcc-9-20191116/gcc/recog.c:2310
0x825053 instantiate_virtual_regs_in_insn
        ../../gcc-9-20191116/gcc/function.c:1605
0x825053 instantiate_virtual_regs
        ../../gcc-9-20191116/gcc/function.c:1975
0x825053 execute
        ../../gcc-9-20191116/gcc/function.c:2024
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-snapshot8 --version
gcc (GCC) 8.3.1 20191108
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ gcc-snapshot8 test.c 
test.c: In function ‘foo’:
test.c:7:30: warning: initialization of ‘volatile int *’ from incompatible
pointer type ‘volatile int **’ [-Wincompatible-pointer-types]
         volatile int * bar = & bar ;
                              ^
test.c:10:1: error: unrecognizable insn:
 }
 ^
(insn 12 11 16 4 (set (mem/f/c:DI (plus:DI (reg/f:DI 82 virtual-stack-vars)
                (const_int -16 [0xfffffffffffffff0])) [1 bar+0 S8 A64])
        (zero_extend:DI (reg:QI 89))) "test.c":8 -1
     (nil))
during RTL pass: vregs
test.c:10:1: internal compiler error: in extract_insn, at recog.c:2309
0x5c3431 _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
        ../../gcc-8-20191108/gcc/rtl-error.c:108
0x5c344d _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
        ../../gcc-8-20191108/gcc/rtl-error.c:116
0x5c25ca extract_insn(rtx_insn*)
        ../../gcc-8-20191108/gcc/recog.c:2309
0x80e03f instantiate_virtual_regs_in_insn
        ../../gcc-8-20191108/gcc/function.c:1599
0x80e03f instantiate_virtual_regs
        ../../gcc-8-20191108/gcc/function.c:1969
0x80e03f execute
        ../../gcc-8-20191108/gcc/function.c:2018
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.

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

I know that previous versions of gcc-8 are no longer supported, but I think
pasting test results of previous versions here will help fix the bug

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

$ gcc-snapshot7 --version
gcc (GCC) 7.4.1 20191107
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


$ gcc-snapshot7 test.c 
test.c: In function ‘foo’:
test.c:7:30: warning: initialization from incompatible pointer type
[-Wincompatible-pointer-types]
         volatile int * bar = & bar ;
                              ^
test.c:10:1: error: unrecognizable insn:
 }
 ^
(insn 12 11 16 4 (set (mem/f/c:DI (plus:DI (reg/f:DI 82 virtual-stack-vars)
                (const_int -16 [0xfffffffffffffff0])) [1 bar+0 S8 A64])
        (zero_extend:DI (reg:QI 89))) "test.c":8 -1
     (nil))
test.c:10:1: internal compiler error: in extract_insn, at recog.c:2311
0x9bb958 _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
        ../../gcc-7-20191107/gcc/rtl-error.c:108
0x9bb989 _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
        ../../gcc-7-20191107/gcc/rtl-error.c:116
0x98b27f extract_insn(rtx_insn*)
        ../../gcc-7-20191107/gcc/recog.c:2311
0x7d4d43 instantiate_virtual_regs_in_insn
        ../../gcc-7-20191107/gcc/function.c:1589
0x7d4d43 instantiate_virtual_regs
        ../../gcc-7-20191107/gcc/function.c:1957
0x7d4d43 execute
        ../../gcc-7-20191107/gcc/function.c:2006
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-6.5.0 --version
gcc (GCC) 6.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ gcc-6.5.0 test.c 
test.c: In function ‘foo’:
test.c:7:30: warning: initialization from incompatible pointer type
[-Wincompatible-pointer-types]
         volatile int * bar = & bar ;
                              ^
test.c:10:1: error: unrecognizable insn:
 }
 ^
(insn 12 11 16 4 (set (mem/f/c:DI (plus:DI (reg/f:DI 82 virtual-stack-vars)
                (const_int -16 [0xfffffffffffffff0])) [1 bar+0 S8 A64])
        (zero_extend:DI (reg:QI 89))) test.c:8 -1
     (nil))
test.c:10:1: internal compiler error: in extract_insn, at recog.c:2287
0x975158 _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
        ../../gcc-6.5.0/gcc/rtl-error.c:108
0x975189 _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
        ../../gcc-6.5.0/gcc/rtl-error.c:116
0x943e81 extract_insn(rtx_insn*)
        ../../gcc-6.5.0/gcc/recog.c:2287
0x7a34fb instantiate_virtual_regs_in_insn
        ../../gcc-6.5.0/gcc/function.c:1582
0x7a34fb instantiate_virtual_regs
        ../../gcc-6.5.0/gcc/function.c:1950
0x7a34fb execute
        ../../gcc-6.5.0/gcc/function.c:1999
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.

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

$ gcc-5.4.0 --version
gcc (GCC) 5.4.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


$ gcc-5.4.0 test.c 
test.c: In function ‘foo’:
test.c:7:30: warning: initialization from incompatible pointer type
[-Wincompatible-pointer-types]
         volatile int * bar = & bar ; 
                              ^
/usr/lib/x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status

Reply via email to