This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC] Fix PR target/20301


Hi,

The submitter of this PR managed to cause the compiler to emit labels with 
negative index numbers (big jar file, >= 2^31 labels) on SPARC/Solaris.
The problem stems from:

 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM)	\
  sprintf ((LABEL), "*.L%s%ld", (PREFIX), (long)(NUM))

on Solaris.  A quick grep shows that most macros use the signed version, while 
the others do use the unsigned one which seems more correct to me.  Any 
specific reason for the discrepancy?

Tested SPARC/Solaris 2.5.1 up to 10.


2005-06-06  Eric Botcazou  <ebotcazou@libertysurf.fr>

        PR target/20301
	* config/sparc/sol2.h (ASM_GENERATE_INTERNAL_LABEL): Emit
	unsigned index numbers.


-- 
Eric Botcazou
Index: config/sparc/sol2.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sparc/sol2.h,v
retrieving revision 1.70
diff -u -r1.70 sol2.h
--- config/sparc/sol2.h	18 May 2005 07:22:28 -0000	1.70
+++ config/sparc/sol2.h	5 Jun 2005 11:53:04 -0000
@@ -72,7 +72,7 @@
 
 #undef  ASM_GENERATE_INTERNAL_LABEL
 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM)	\
-  sprintf ((LABEL), "*.L%s%ld", (PREFIX), (long)(NUM))
+  sprintf ((LABEL), "*.L%s%lu", (PREFIX), (unsigned long)(NUM))
 
 /* The native TLS-enabled assembler requires the directive #tls_object
    to be put on objects in TLS sections (as of v7.1).  This is not

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]