Hi,
On Thu, 11 Jun 2020 at 22:37, Rainer Orth <r...@cebitec.uni-bielefeld.de> wrote: > > Hi Martin, > > > The compute_objsize() function started out as a thin wrapper around > > compute_builtin_object_size(), but over time developed its own > > features to compensate for the other function's limitations (such > > as its inability to work with ranges). The interaction of these > > features and the limitations has started to become increasingly > > problematic as the former function is used in more contexts. > > > > A complete "fix" for all the problems (as well as some other > > limitations) that I'm working on will be more extensive and won't > > be appropriate for backports. Until then, the attached patch > > cleans up the extensions compute_objsize() has accumulated over > > the years to avoid a class of false positives. > > > > To make the warnings issued based on the results of the function > > easier to understand and fix, the patch also adds an informative > > message to many instances of -Wstringop-overflow to point to > > the object to which the warning refers. This is especially > > helpful when the object is referenced by a series of pointer > > operations. > > > > Tested by boostrapping on x86_64-linux and building Binutils/GDB, > > Glibc, and the Linux kernel with no new warnings. > > > > Besides applying it to trunk I'm looking to backport the fix to > > GCC 10. > > it seems you were over-eager in removing xfail's from > gcc.dg/builtin-stringop-chk-5.c: on both Solaris/SPARC and x86 (32-bit > only) I see > > +FAIL: gcc.dg/builtin-stringop-chk-5.c (test for excess errors) > +FAIL: gcc.dg/builtin-stringop-chk-5.c memcpy into allocated (test for > warnings, line 136) > +FAIL: gcc.dg/builtin-stringop-chk-5.c memcpy into allocated (test for > warnings, line 139) > +FAIL: gcc.dg/builtin-stringop-chk-5.c memcpy into allocated (test for > warnings, line 142) > +FAIL: gcc.dg/builtin-stringop-chk-5.c memcpy into allocated (test for > warnings, line 145) > +FAIL: gcc.dg/builtin-stringop-chk-5.c memcpy into allocated (test for > warnings, line 148) > +FAIL: gcc.dg/builtin-stringop-chk-5.c memcpy into allocated (test for > warnings, line 151) > > Excess errors: > /vol/gcc/src/hg/master/local/gcc/testsuite/gcc.dg/builtin-stringop-chk-5.c:136:3: > warning: 'memset' writing 4 bytes into a region of size 1 overflows the > destination [-Wstringop-overflow=] > /vol/gcc/src/hg/master/local/gcc/testsuite/gcc.dg/builtin-stringop-chk-5.c:139:3: > warning: 'memset' writing 4 bytes into a region of size 1 overflows the > destination [-Wstringop-overflow=] > /vol/gcc/src/hg/master/local/gcc/testsuite/gcc.dg/builtin-stringop-chk-5.c:142:3: > warning: 'memset' writing 3 bytes into a region of size 1 overflows the > destination [-Wstringop-overflow=] > /vol/gcc/src/hg/master/local/gcc/testsuite/gcc.dg/builtin-stringop-chk-5.c:145:3: > warning: 'memset' writing 3 bytes into a region of size 1 overflows the > destination [-Wstringop-overflow=] > /vol/gcc/src/hg/master/local/gcc/testsuite/gcc.dg/builtin-stringop-chk-5.c:148:3: > warning: 'memset' writing 2 bytes into a region of size 1 overflows the > destination [-Wstringop-overflow=] > /vol/gcc/src/hg/master/local/gcc/testsuite/gcc.dg/builtin-stringop-chk-5.c:151:3: > warning: 'memset' writing 2 bytes into a region of size 1 overflows the > destination [-Wstringop-overflow=] > I see the same error messages on arm. Christophe > Rainer > > -- > ----------------------------------------------------------------------------- > Rainer Orth, Center for Biotechnology, Bielefeld University