Using a global variable tied to register g7 generates invalid assembly code on sparc64.
Consider: register void *tp __asm__("%g7"); void set_tp() { tp = 0; } Compiling this file produces an error and a warning from the assembler: /usr/ccs/bin/as: "/var/tmp//ccLsIpQg.s", line 2: error: statement syntax /usr/ccs/bin/as: "/var/tmp//ccLsIpQg.s", line 10: warning: detect global register use not covered .register pseudo-op Environment: System: SunOS plg2.math 5.8 Generic_117350-18 sun4u sparc SUNW,Sun-Fire-880 Architecture: sun4 host: sparc64-sun-solaris2.8 build: sparc64-sun-solaris2.8 target: sparc64-sun-solaris2.8 configured with: ../gcc/configure --prefix=/u/rcbilson/software/gcc --enable-languages=c,c++ sparc64-sun-solaris2.8 How-To-Repeat: Attempt to compile the above program fragment. ------- Additional Comments From rcbilson at plg dot uwaterloo dot ca 2005-03-01 16:45 ------- Fix: Examining the -S output shows that the .register op generated by the compiler is .register %g7, %g7 The second operand seems to be incorrect -- it ought to be a plain name, not a register name. Replacing this op with .register %g7, g7 allows the code to assemble, eliminating both the error and the warning. I don't know enough about .register to be confident in suggesting an appropriate identifier to use for the second operand. -- Summary: Incorrect asm for global register vars on sparc64 Product: gcc Version: 1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rcbilson at plg dot uwaterloo dot ca CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: sparc64-sun-solaris2.8 GCC host triplet: sparc64-sun-solaris2.8 GCC target triplet: sparc64-sun-solaris2.8 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20263