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]

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?

		Thanks,
		--Kaveh


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-CVS20030516/gcc/config/vax/vax.h egcc-CVS20030516/gcc/config/vax/vax.h
--- orig/egcc-CVS20030516/gcc/config/vax/vax.h	2003-05-12 20:02:33.000000000 -0400
+++ egcc-CVS20030516/gcc/config/vax/vax.h	2003-05-16 13:27:43.902271988 -0400
@@ -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" HOST_WIDE_INT_PRINT_DEC, PREFIX, (HOST_WIDE_INT) (NUM))
 
 /* This is how to output an insn to push a register on the stack.
    It need not be very fast code.  */
@@ -1136,22 +1136,22 @@ VAX operand formatting codes:
   else if (CODE == 'C')							\
     fputs (rev_cond_name (X), FILE);					\
   else if (CODE == 'D' && GET_CODE (X) == CONST_INT && INTVAL (X) < 0)	\
-    fprintf (FILE, "$0xffffffff%08x", INTVAL (X));			\
+    fprintf (FILE, "$0xffffffff%08x", (int) 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]