http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46187
Summary: Invalid instruction suffix generated by %z Product: gcc Version: 4.4.5 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassig...@gcc.gnu.org ReportedBy: u...@os.inf.tu-dresden.de Created attachment 22163 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22163 Testcase The testcase compiled with -Os should produce something like the following: 4004cc: f0 80 6c 24 ff 01 lock subb $0x1,-0x1(%rsp) 4004d5: f0 66 83 6c 24 fc 02 lock subw $0x2,-0x4(%rsp) 4004df: f0 48 83 6c 24 f0 03 lock subq $0x3,-0x10(%rsp) This works correctly on 4.5.1 and 4.6.0. Older compilers fail as shown below. The code is supposed to emit the correct instruction suffix for SUB using %z when n is an immediate value that does not give the operand size away. Is there another way to achieve the same effect? g++-gcc-4.1.2 -Os testcase.cc -o testcase testcase.cc: In function 'int main()': testcase.cc:20: internal compiler error: in print_operand, at config/i386/i386.c:7226 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. g++-gcc-4.2.4 -Os testcase.cc -o testcase testcase.cc: In function 'int main()': testcase.cc:20: internal compiler error: in print_operand, at config/i386/i386.c:7791 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. g++-gcc-4.3.5 -Os testcase.cc -o testcase testcase.cc: Assembler messages: testcase.cc:5: Error: invalid instruction suffix for `sub' testcase.cc:5: Error: no such instruction: `subll $3,-16(%rsp)' g++-gcc-4.4.5 -Os testcase.cc -o testcase testcase.cc: Assembler messages: testcase.cc:5: Error: invalid instruction suffix for `sub' testcase.cc:5: Error: no such instruction: `subll $3,-16(%rsp)'