On Thu, 2020-06-18 at 08:56 -0600, Martin Sebor via Gcc-patches wrote:
> In the recent fix to avoid false positives due to compute_objsize
> (PR 95353) where I removed the call to compute_builtin_object_size
> when computing object sizes for calls to string functions like
> strcpy, I kept it out of a misplaced abundance of caution when
> doing the same for the more permissive memcpy and memset. It
> turned out to be a mistake because it triggered another false
> positive warning in a case when the call wasn't made due to
> the new structure. Rather than continuing to rely on the function
> (and continue to try to cope with its limitations) the attached
> patch replaces the call with its own computation. That keeps all
> the logic in one place and avoids the limitations.
>
> Like the patch for PR 95353, I tested this fix by building Glibc,
> Binutils/GDB, and the kernel on x86_64-linux with no new warnings
> (of course, that didn't prevent the false positive from turning
> up in a Glibc build on nios2-linux-gnu).
>
> Martin
>
> PS This isn't meant to resolve the underlying problem with the PRE
> transformation substituting one member for another with the same
> offset.
>
> PPS I have WIP patches for GCC 11 tweaking this area in a number
> of ways, so this is just a narrow fix for the expected permissive
> treatment of memset and other memory functions writing across
> subobject boundaries.
OK
jeff