gcc inline keyword & inline assembler bug (FreeBSD i386 c-code)

Florian Weimer fw@deneb.enyo.de
Fri Oct 5 08:20:00 GMT 2001


Kristofer Sandlund <kristofer.sandlund@effnet.com> writes:

> I seem to have located some strange bug in gcc 3.0.1, which I'll try to
> describe below here.

>     __asm__(
>             "\tCPUID\n"
>             "\tRDTSC\n"
>             :"=d" (c_high), "=a" (c_low)
>             );

According to the Intel documentation I've got here, CPUID clobbers a
few additional registers, so the behavior of this asm statement is
undefined for all GCC versions, and it is extremely likely that the
behavior depends on the compiler flags (such as optimization level).



More information about the Gcc-bugs mailing list