Following testcases ICEs with current mainline:

--cut here--
char c;

void testc(void)
{
  (void) __sync_fetch_and_add(&c, -1);
}

short s;

void tests(void)
{
  (void) __sync_fetch_and_add(&s, -1);
}
--cut here--

inc.c: In function âtestsâ:
inc.c:13: error: unrecognizable insn:
(insn 10 8 11 3 (set (reg:HI 58)
        (const_int 65535 [0xffff])) -1 (nil)
    (nil))
inc.c:13: internal compiler error: in extract_insn, at recog.c:2077
Please submit a full bug report,

and:

inc.c: In function âtestcâ:
inc.c:6: error: unrecognizable insn:
(insn 7 5 8 3 (set (reg:QI 58)
        (const_int 255 [0xff])) -1 (nil)
    (nil))
inc.c:6: internal compiler error: in extract_insn, at recog.c:2077
Please submit a full bug report,

ICE happens for all optimization levels, also for unsigned c and s variables. I
have checked _sync_fetch_and_add() and _sync_fetch_and_sub() builtins, but due
to the nature of error all other sync_* builtins may be affected.


-- 
           Summary: x86 sync builtins fail for char and short memory
                    operands
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: uros at kss-loka dot si
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28924

Reply via email to