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]

Re: Patch for vax warnings (would like review)


 > While this is mostly obvious, there's one nit I'd like a second
 > opinion on.  The 'D' case below where the format specifier is
 > "$0xffffffff%08x" assumes a that `X' contains a 32-bit integer
 > argument.  I cast the HOST_WIDE_INT down to int, but of course HWI can
 > be 64-bit on some hosts.  Is this safe here?
 > 
 > The rest of the changes are "obvious" by inspection.
 > Tested for warnings by building cc1 with target=vax-unknown-elf.
 > 
 > Ok for mainline?


It's been around two weeks, so I checked in the "obvious" bits and
left out the part I had a question on.  I also changed the
ASM_GENERATE_INTERNAL_LABEL hunk to use `long', since every other
definition that casted the argument did that.

Here's the final patch I installed.


2003-05-16  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* vax.h (ASM_GENERATE_INTERNAL_LABEL): Fix format specifier
	warnings.
	(PRINT_OPERAND): Likewise.

diff -rup orig/egcc-CVS20030529/gcc/config/vax/vax.h egcc-CVS20030529/gcc/config/vax/vax.h
--- orig/egcc-CVS20030529/gcc/config/vax/vax.h	Mon May 12 20:02:33 2003
+++ egcc-CVS20030529/gcc/config/vax/vax.h	Fri May 30 09:48:53 2003
@@ -1019,7 +1019,7 @@ enum reg_class { NO_REGS, ALL_REGS, LIM_
    This is suitable for output with `assemble_name'.  */
 
 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM)	\
-  sprintf (LABEL, "*%s%d", PREFIX, NUM)
+  sprintf (LABEL, "*%s%ld", PREFIX, (long)(NUM))
 
 /* This is how to output an insn to push a register on the stack.
    It need not be very fast code.  */
@@ -1138,20 +1138,20 @@ VAX operand formatting codes:
   else if (CODE == 'D' && GET_CODE (X) == CONST_INT && INTVAL (X) < 0)	\
     fprintf (FILE, "$0xffffffff%08x", INTVAL (X));			\
   else if (CODE == 'P' && GET_CODE (X) == CONST_INT)			\
-    fprintf (FILE, "$%d", INTVAL (X) + 1);				\
+    fprintf (FILE, "$" HOST_WIDE_INT_PRINT_DEC, INTVAL (X) + 1);	\
   else if (CODE == 'N' && GET_CODE (X) == CONST_INT)			\
-    fprintf (FILE, "$%d", ~ INTVAL (X));				\
+    fprintf (FILE, "$" HOST_WIDE_INT_PRINT_DEC, ~ INTVAL (X));		\
   /* rotl instruction cannot deal with negative arguments.  */		\
   else if (CODE == 'R' && GET_CODE (X) == CONST_INT)			\
-    fprintf (FILE, "$%d", 32 - INTVAL (X));				\
+    fprintf (FILE, "$" HOST_WIDE_INT_PRINT_DEC, 32 - INTVAL (X));	\
   else if (CODE == 'H' && GET_CODE (X) == CONST_INT)			\
-    fprintf (FILE, "$%d", 0xffff & ~ INTVAL (X));			\
+    fprintf (FILE, "$%d", (int) (0xffff & ~ INTVAL (X)));		\
   else if (CODE == 'h' && GET_CODE (X) == CONST_INT)			\
     fprintf (FILE, "$%d", (short) - INTVAL (x));			\
   else if (CODE == 'B' && GET_CODE (X) == CONST_INT)			\
-    fprintf (FILE, "$%d", 0xff & ~ INTVAL (X));				\
+    fprintf (FILE, "$%d", (int) (0xff & ~ INTVAL (X)));			\
   else if (CODE == 'b' && GET_CODE (X) == CONST_INT)			\
-    fprintf (FILE, "$%d", 0xff & - INTVAL (X));				\
+    fprintf (FILE, "$%d", (int) (0xff & - INTVAL (X)));			\
   else if (CODE == 'M' && GET_CODE (X) == CONST_INT)			\
     fprintf (FILE, "$%d", ~((1 << INTVAL (x)) - 1));			\
   else if (GET_CODE (X) == REG)						\


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