[jit] Fix compilation of jit test with -Wformat-security

Message ID ad169ee1-6596-e621-21b5-be92b98fc6c7@ubuntu.com
State New
Headers show
Series
  • [jit] Fix compilation of jit test with -Wformat-security
Related show

Commit Message

Matthias Klose Nov. 26, 2018, 9:20 a.m.
test-long-names.c fails to build when -Wformat-security is turned on.  Fixed by
the below patch. Alternatives would be to use a plain strcpy, or to turn off the
option in a dg header. Ok to commit, including active branches?

Matthias

Comments

David Malcolm Nov. 26, 2018, 10:23 a.m. | #1
On Mon, 2018-11-26 at 10:20 +0100, Matthias Klose wrote:
> test-long-names.c fails to build when -Wformat-security is turned

> on.  Fixed by

> the below patch. Alternatives would be to use a plain strcpy, or to

> turn off the

> option in a dg header. Ok to commit, including active branches?

> 

> Matthias


OK

Patch

gcc/testsuite/

2018-11-26  Matthias Klose  <doko@ubuntu.com>

	* jit.dg/test-long-names.c: Fix build with -Wformat-security.

Index: gcc/testsuite/jit.dg/test-long-names.c
===================================================================
--- gcc/testsuite/jit.dg/test-long-names.c	(revision 266426)
+++ gcc/testsuite/jit.dg/test-long-names.c	(working copy)
@@ -24,7 +24,7 @@ 
   int i;
 
   /* Begin with the given prefix: */
-  sprintf (buffer, prefix);
+  sprintf (buffer, "%s", prefix);
 
   /* Populate the rest of the buffer with 0123456789 repeatedly: */
   for (i = strlen (prefix); i < NAME_LENGTH - 1; i++)