https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62218
Bug ID: 62218 Summary: gcc produces invalid SH instruction (stc r2,sr) when building libgcc Product: gcc Version: 4.9.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: dhowells at redhat dot com Created attachment 33374 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33374&action=edit Reduced test case A gcc build for SH produces an invalid opcode when building libgcc. It produces "stc sr,rN" when it should produce "ldc sr,rN". /data/fedora/cross-gcc/gcc-4.9.1-20140717/sh-linux-gnu/./gcc/xgcc -B/data/fedora/cross-gcc/gcc-4.9.1-20140717/sh-linux-gnu/./gcc/ -B/usr/sh-linux-gnu/bin/ -O2 -mb -fpic -w -Wno-sync-nand -fbuilding-libgcc -o /tmp/linux-atomic.o -c /tmp/linux-atomic.i /tmp/ccHwXin4.s: Assembler messages: /tmp/ccHwXin4.s:19: Error: invalid operands for opcode /tmp/ccHwXin4.s:38: Error: invalid operands for opcode /tmp/ccHwXin4.s:56: Error: invalid operands for opcode Interestingly, if -Wno-sync-nand is removed, I see this: /tmp/linux-atomic.i:7:2: note: ‘__sync_fetch_and_nand’ changed semantics in GCC 4.4 return __sync_fetch_and_nand (x, y, z); in addition. I've attached /tmp/linux-atomic.i as a reduced test case.