On 01/24/2017 08:36 PM, Martin Sebor wrote:
In implementing the -Wstringop-overflow warning I missed stpcpy.
The attached patch adds the required checking. Given how simple
it is, does it qualify for GCC 7 despite stage 4?
Martin
gcc-79222.diff
PR middle-end/79222 - missing -Wstringop-overflow= on a stpcpy overflow
gcc/ChangeLog:
PR middle-end/79222
* builtins.c (expand_builtin_stpcpy): Check for buffer overflow.
gcc/testsuite/ChangeLog:
PR middle-end/79222
* gcc.dg/builtin-stringop-chk-4.c: Add test cases.
* gcc.dg/pr79222.c: New test.
I think we should probably defer this as well. We're really at a place
where we'd really prefer to avoid making unnecessary changes. My worry
with this patch is we could start seeing code which used stpcpy start
giving warnings. It's unlikely (as I don't think stpcpy is used that
much), but I'd rather wait.
And ISTM that we may be better keeping the tests separate (ie, a new
test file rather than included in stringop-chk-4.c). It makes merges
easier if something does need to change in that file for gcc-7.
Our focus really needs to be on issues that affect our ability to make a
release. ie, regressions.
Jeff