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] Fix a number of -Wformat-security warnings in gcc/config/*/*


	* config/avr/avr.c (avr_print_operand_address, avr_print_operand): Avoid
	-Wformat-security warning.
	* config/m68k/m68k.c (print_operand): Likewise.
	* config/s390/s390.c (print_operand): Likewise.
	* config/tilegx/tilegx.c (tilegx_print_operand): Likewise.

--- gcc/config/avr/avr.c.orig	2015-02-12 16:42:25.915682864 +0000
+++ gcc/config/avr/avr.c	2015-02-12 16:43:12.946934049 +0000
@@ -2107,7 +2107,7 @@ avr_print_operand_address (FILE *file, r
   switch (GET_CODE (addr))
     {
     case REG:
-      fprintf (file, ptrreg_to_str (REGNO (addr)));
+      fprintf (file, "%s", ptrreg_to_str (REGNO (addr)));
       break;
 
     case PRE_DEC:
@@ -2221,12 +2221,12 @@ avr_print_operand (FILE *file, rtx x, in
   else if (code == 'E' || code == 'F')
     {
       rtx op = XEXP(x, 0);
-      fprintf (file, reg_names[REGNO (op) + ef]);
+      fprintf (file, "%s", reg_names[REGNO (op) + ef]);
     }
   else if (code == 'I' || code == 'J')
     {
       rtx op = XEXP(XEXP(x, 0), 0);
-      fprintf (file, reg_names[REGNO (op) + ij]);
+      fprintf (file, "%s", reg_names[REGNO (op) + ij]);
     }
   else if (REG_P (x))
     {
@@ -2235,7 +2235,7 @@ avr_print_operand (FILE *file, rtx x, in
       else if (code == 'r' && REGNO (x) < 32)
         fprintf (file, "%d", (int) REGNO (x));
       else
-        fprintf (file, reg_names[REGNO (x) + abcd]);
+        fprintf (file, "%s", reg_names[REGNO (x) + abcd]);
     }
   else if (CONST_INT_P (x))
     {
--- gcc/config/m68k/m68k.c.orig	2015-02-13 11:29:22.395433678 +0000
+++ gcc/config/m68k/m68k.c	2015-02-13 11:29:29.463468222 +0000
@@ -4469,7 +4469,7 @@ print_operand (FILE *file, rtx op, int l
   else if (letter == '/')
     asm_fprintf (file, "%R");
   else if (letter == '?')
-    asm_fprintf (file, m68k_library_id_string);
+    asm_fprintf (file, "%s", m68k_library_id_string);
   else if (letter == 'p')
     {
       output_addr_const (file, op);
--- gcc/config/s390/s390.c.orig	2015-02-12 20:06:35.909940703 +0000
+++ gcc/config/s390/s390.c	2015-02-12 20:06:47.627008105 +0000
@@ -5481,11 +5481,11 @@ print_operand (FILE *file, rtx x, int co
   switch (code)
     {
     case 'C':
-      fprintf (file, s390_branch_condition_mnemonic (x, FALSE));
+      fprintf (file, "%s", s390_branch_condition_mnemonic (x, FALSE));
       return;
 
     case 'D':
-      fprintf (file, s390_branch_condition_mnemonic (x, TRUE));
+      fprintf (file, "%s", s390_branch_condition_mnemonic (x, TRUE));
       return;
 
     case 'E':
--- gcc/config/tilegx/tilegx.c.orig	2015-02-12 21:11:36.070847024 +0000
+++ gcc/config/tilegx/tilegx.c	2015-02-12 21:11:42.891875824 +0000
@@ -5397,7 +5397,7 @@ tilegx_print_operand (FILE *file, rtx x,
 	    gcc_unreachable ();
 	  }
 
-	fprintf (file, reg);
+	fprintf (file, "%s", reg);
 	return;
       }
 


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