Global register variables rear their ugly head again. Here's a simple test case that generates incorrect code on x86_64 with gcc 3.4.2:
$ cat bug.c register void * R1 __asm__("%r13"); extern void g(void); static void f(void) { R1 = g; goto *R1; } $ gcc -v Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/specs Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux Thread model: posix gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5) $ gcc -O -S bug.c The generated code for function f is: f: .LFB2: movl $g, %eax jmp *%rax Note the assignment to the global register variable R1 has been lost. This is breaking the Glasgow Haskell Compiler (http://www.haskell.org/ghc/) on the x86_64 platform. It might be related to the (closed) bug #7871. -- Summary: Incorrect code with global register variables Product: gcc Version: 3.4.2 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: simonmar at microsoft dot com CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: x86_64-*-linux GCC host triplet: x86_64-*-linux GCC target triplet: x86_64-*-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20359