[Bug middle-end/85369] no -Wstringop-overflow for a strcpy / stpcpy call with a nonstring pointer when providing movstr pattern
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Apr 12 18:58:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85369
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2018-04-12
Ever confirmed|0 |1
--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Confirmed. A small standalone test case is below shwoing that an x86_64 GCC
issues the expected warning but the s360-linux one doesn't.
$ (set -x && cat pr85369.c && /ssd/build/gcc-git/gcc/xgcc -B
/ssd/build/gcc-git/gcc -O2 -S -Wall pr85369.c &&
/ssd/build/s390-linux/gcc-git/gcc/xgcc -B /ssd/build/s390-linux/gcc-git/gcc -O2
-S -Wall pr85369.c)
+ cat pr85369.c
char* g (char *d, __attribute__ ((nonstring)) const char *s)
{
return __builtin_stpcpy (d, s);
}
+ /ssd/build/gcc-git/gcc/xgcc -B /ssd/build/gcc-git/gcc -O2 -S -Wall pr85369.c
pr85369.c: In function ‘g’:
pr85369.c:3:10: warning: ‘__builtin_stpcpy’ argument 2 declared attribute
‘nonstring’ [-Wstringop-overflow=]
return __builtin_stpcpy (d, s);
^~~~~~~~~~~~~~~~~~~~~~~
pr85369.c:1:59: note: argument ‘s’ declared here
char* g (char *d, __attribute__ ((nonstring)) const char *s)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
+ /ssd/build/s390-linux/gcc-git/gcc/xgcc -B /ssd/build/s390-linux/gcc-git/gcc
-O2 -S -Wall pr85369.c
More information about the Gcc-bugs
mailing list