This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug inline-asm/39393] invalid instructions accepted in inline assembly language on 32 bit machines
- From: "hjl dot tools at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 7 Mar 2009 01:31:24 -0000
- Subject: [Bug inline-asm/39393] invalid instructions accepted in inline assembly language on 32 bit machines
- References: <bug-39393-17223@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from hjl dot tools at gmail dot com 2009-03-07 01:31 -------
(In reply to comment #0)
> 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.
>
I got
hjl@gnu-9 tmp]$ gcc -march=i386 -Wa,-march=i386 a.c
/tmp/cciG1xw8.s: Assembler messages:
/tmp/cciG1xw8.s:17: Error: `cpuid' is not supported on `i386'
on Linux/ia32 with the current Linux binutils.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39393