Commit 4aeba1b7 by Andreas Krebbel Committed by Andreas Krebbel

S/390: PR83420: Improve hotpatch option parsing.

With the attached patch we get rid of the following build failure:

/home/andreas/build/../gcc/gcc/config/s390/s390.c: In function ‘void
s390_option_override()’:
/home/andreas/build/../gcc/gcc/config/s390/s390.c:15361:16: error: ‘char*
strncpy(char*, const char*, size_t)’ specified bound 256 equals destination
size [-Werror=stringop-truncation]
        strncpy (s, opt->arg, 256);
        ~~~~~~~~^~~~~~~~~~~~~~~~~~

gcc/ChangeLog:

2017-12-18  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	PR target/83420
	* config/s390/s390.c (s390_option_override): Avoid strncpy.

From-SVN: r255777
parent bcfaa720
2017-12-18 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
PR target/83420
* config/s390/s390.c (s390_option_override): Avoid strncpy.
2017-12-18 Richard Biener <rguenther@suse.de> 2017-12-18 Richard Biener <rguenther@suse.de>
PR tree-optimization/81877 PR tree-optimization/81877
...@@ -15357,16 +15357,11 @@ s390_option_override (void) ...@@ -15357,16 +15357,11 @@ s390_option_override (void)
{ {
int val1; int val1;
int val2; int val2;
char s[256]; char *s = strtok (ASTRDUP (opt->arg), ",");
char *t; char *t = strtok (NULL, "\0");
strncpy (s, opt->arg, 256);
s[255] = 0;
t = strchr (s, ',');
if (t != NULL) if (t != NULL)
{ {
*t = 0;
t++;
val1 = integral_argument (s); val1 = integral_argument (s);
val2 = integral_argument (t); val2 = integral_argument (t);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment