On Mon, Apr 25, 2022 at 11:54:34AM +0200, Richard Biener wrote: > The following extends the equality compare dangling pointer diagnostics > suppression for uses following free or realloc to also cover those > following invalidation of auto variables via CLOBBERs. That avoids > diagnosing idioms like > > return std::find(std::begin(candidates), std::end(candidates), s) > != std::end(candidates); > > for auto candidates which are prone to forwarding of the final > comparison across the storage invalidation as then seen by the > late run access warning pass. > > Bootstrapped and tested on x86_64-unknown-linux-gnu. > > OK for trunk? > > Thanks, > Richard. > > 2022-04-25 Richard Biener <rguent...@suse.de> > > PR middle-end/104492 > * gimple-ssa-warn-access.cc > (pass_waccess::warn_invalid_pointer): Exclude equality compare > diagnostics for all kind of invalidations. > > * c-c++-common/Wdangling-pointer.c: Adjust for changed > suppression. > * c-c++-common/Wdangling-pointer-2.c: Likewise.
I spoke with Martin on IRC and his comment was that this is ok but should be accompanied with a doc/invoke.texi change that clarifies that behavior in the documentation. I think that is a reasonable request. Jakub