On 04/12/2018 06:00 PM, Martin Sebor wrote: > PR 85369 notes that the c-c++-common/attr-nonstring-3.c fails > on IBM Z (and other similar targets) whose back-end provides > the movstr expander. The failure is cause by an expected > warning failing to trigger because the strcpy call is expanded > early and the checker never runs. > > The attached patch adjusts the code to make sure the warning > is not bypassed on these targets. > > I've verified the patch with an s390-linux cross-compiler and > with a full x86_64-linux native build and regression run. > > Martin > > gcc-85369.diff > > > PR middle-end/85369 - no -Wstringop-overflow for a strcpy / stpcpy call with > a nonstring pointer when providing movstr pattern > > gcc/ChangeLog: > > PR middle-end/85369 > * builtins.c (expand_builtin_strcpy_1): New function. Patch actually introduced expand_builtin_stpcpy_1, not expand_builtin_strcpy_1.
> (expand_builtin_stpcpy): Call it, and call maybe_warn_nonstring_arg > only if the former succeeds. OK with ChangeLog nit fixed. jeff