On 8/13/18 3:28 PM, Martin Sebor wrote: > The attached changes implement the detection of past-the-end reads > by stpcpy due to unterminated arguments. > > > gcc-86552-5.diff > > PR tree-optimization/86552 - missing warning for reading past the end of > non-string arrays > > gcc/ChangeLog: > > * builtins.c (unterminated_array): Handle ARRAY_REF. > (expand_builtin_stpcpy_1): Detect unterminated char arrays. > * builtins.h (unterminated_array): Declare extern. > * gimple-fold.c (gimple_fold_builtin_stpcpy): Detect unterminated > arrays. > (gimple_fold_builtin_sprintf): Propagate NO_WARNING to transformed > calls. > > gcc/testsuite/ChangeLog: > > * gcc.dg/warn-stpcpy-no-nul.c: New test. So with this patch I just added initialization for a NONSTR passed down to c_strlen. Otherwise it just worked on top of all the recent changes.
I'll install it on the trunk momentarily. I'll probably stop here today to let the testers run through another cycle. What's left of this kit is #4 (sprintf) and #6 (strnlen). Jeff