This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug inline-asm/39393] invalid instructions accepted in inline assembly language on 32 bit machines



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]