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

            Bug ID: 69644
           Summary: ICE with -O on __sync_bool_compare_and_swap with short
                    in extract_insn, at recog.c:2286
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

GCC fails with an ICE on the following test case derived from the one in bug
58490.  -O is necessary to trigger it, as is the magic constant 0x8000 and the
tests.  It looks similar to bug 63805 but the instruction is different.  5.3.0
fails as well.

$ cat t.c && /build/gcc-trunk/gcc/xgcc -B /build/gcc-trunk/gcc -O -S -Wall
-Wextra -Wpedantic t.c
void foo (void)
{
    unsigned short x = 0x8000;
    unsigned short y = 0;

    char c = __sync_bool_compare_and_swap (&x, x, y);
    if (!c) __builtin_abort ();
    if (x != y) __builtin_abort ();
}
t.c: In function ‘foo’:
t.c:9:1: error: unrecognizable insn:
 }
 ^
(insn 11 10 12 4 (set (reg:CC 163)
        (compare:CC (reg:SI 162)
            (const_int 32768 [0x8000]))) t.c:6 -1
     (nil))
t.c:9:1: internal compiler error: in extract_insn, at recog.c:2286
0x10c5ad33 _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
        /src/gcc/trunk/gcc/rtl-error.c:108
0x10c5adab _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
        /src/gcc/trunk/gcc/rtl-error.c:116
0x10bdf163 extract_insn(rtx_insn*)
        /src/gcc/trunk/gcc/recog.c:2286
0x107d48ff instantiate_virtual_regs_in_insn
        /src/gcc/trunk/gcc/function.c:1582
0x107d668f instantiate_virtual_regs
        /src/gcc/trunk/gcc/function.c:1950
0x107d67ff execute
        /src/gcc/trunk/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.

Reply via email to