The following code (extracted from the Linux kernel) fails to compile with
optimization enabled:
static void load_fs(unsigned short sel)
{
asm("mov %0, %%fs" : : "g"(sel));
}
int main(int argc, char **argv)
{
load_fs(0);
}
[EMAIL PROTECTED] arklinux]$ gcc test.c
[EMAIL PROTECTED] arklinux]$ gcc -O1 test.c
/tmp/ccSpA5Rm.s: Assembler messages:
/tmp/ccSpA5Rm.s:13: Error: suffix or operands invalid for `mov'
gcc is 4.2 SVN revision 118519 (20061106).
--
Summary: [4.2 Regression] Error: suffix or operands invalid for
`mov' when optimization is enabled
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: inline-asm
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bero at arklinux dot org
GCC build triplet: i586-pc-linux-gnu
GCC host triplet: i586-pc-linux-gnu
GCC target triplet: i586-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29808