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] Avoid -Wformat-security in in output_die


Hi!

While name will not contain any % characters, because it is what
dwarf_attr_name returns and there aren't attribute names with % in them,
all other spots that call dw2_asm_output_data use "%s", name instead of
name, so I think we should do the same here.

Ok for trunk if testing succeeds?

2015-02-12  Jakub Jelinek  <jakub@redhat.com>

	* dwarf2out.c (output_die): Use "%s", name instead of name to
	avoid -Wformat-security warning.

--- gcc/dwarf2out.c.jj	2015-02-12 15:41:59.000000000 +0100
+++ gcc/dwarf2out.c	2015-02-12 15:43:32.793119058 +0100
@@ -8897,14 +8897,14 @@ output_die (dw_die_ref die)
 	      for (i = len - 1; i >= 0; --i)
 		{
 		  dw2_asm_output_data (l, a->dw_attr_val.v.val_wide->elt (i),
-				       name);
+				       "%s", name);
 		  name = NULL;
 		}
 	    else
 	      for (i = 0; i < len; ++i)
 		{
 		  dw2_asm_output_data (l, a->dw_attr_val.v.val_wide->elt (i),
-				       name);
+				       "%s", name);
 		  name = NULL;
 		}
 	  }

	Jakub


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