[Bug c/39393] New: invalid instructions accepted in inline assembly language on 32 bit machines

markhobley at yahoo dot co dot uk gcc-bugzilla@gcc.gnu.org
Sat Mar 7 00:51:00 GMT 2009


On an x86_64 bit machine, if an attempt to compile code containing an invalid
instruction is attempted, an error will correctly occur:

cat /etc/testasm.c
int main(void)
  {
  asm("cpuid");       /* Invalid on the i386 */
  }

gcc -march=i386 -Wa,-march=i386 testasm.c

Error: `cpuid' is not supported on `i386'

However on a 32 bit machine, the error trap does not occur, and the invalid
instruction ends up producing an invalid binary file:

gcc -march=i386 -Wa,-march=i386 testasm.c

No error occurs and invalid opcodes are placed in the resultant binary.


-- 
           Summary: invalid instructions accepted in inline assembly
                    language on 32 bit machines
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: markhobley at yahoo dot co dot uk


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



More information about the Gcc-bugs mailing list