On 3/29/23 06:11, Richard Biener via Gcc-patches wrote:
The following tells pointer-query to prefer a zero size when we
are querying for the size range for a write into an object we've
determined is of zero size.  That avoids diagnostics about really
varying size arguments that just get a meaningful range for example
because they are multiplied by an element size.

I've adjusted only one call to get_size_range since that's what
I have a testcase for.  I think this is the most sensible
"workaround" for some of the false positives we see.

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

OK if it succeeds?

Thanks,
Richard.

        PR tree-optimization/107561
        * gimple-ssa-warn-access.cc (get_size_range): Add flags
        argument and pass it on.
        (check_access): When querying for the size range pass
        SR_ALLOW_ZERO when the known destination size is zero.

        * g++.dg/pr71488.C: Remove XFAILed bogus diagnostic again.
        * g++.dg/warn/Warray-bounds-16.C: Likewise.
OK.
jeff

Reply via email to