[forwarded from https://launchpad.net/bugs/590859]
seen with 4.4 branch and -O2, not -O1, works with 4.3. When compiling with : gcc -O2 -c -o proc.o proc.c The generated code is : 0x000000af <+175>: movl $0x0,%gs:0x4 0x000000ba <+186>: lgdtl (%edx) 0x000000bd <+189>: mov $0x18,%edx 0x000000c2 <+194>: mov %edx,%gs 0x000000c4 <+196>: mov %eax,%gs:0x0 When compiling with : gcc -O1 -c -o proc.o proc.c 0x000000af <+175>: lgdtl (%edx) 0x000000b2 <+178>: mov $0x18,%edx 0x000000b7 <+183>: mov %edx,%gs 0x000000b9 <+185>: mov %eax,%gs:0x0 0x000000bf <+191>: movl $0x0,%gs:0x4 The first code is wrong : register GS is used (movl $0x0,%gs:0x4) before loading the GDT (lgdtl (%edx)) -- Summary: [4.4 regression] wrong code (wrong order) generated with -O2 Product: gcc Version: 4.4.4 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: doko at ubuntu dot com GCC target triplet: i486-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44624