On 7/23/21 10:39 AM, Jeff Law wrote:


On 7/22/2021 3:58 PM, Martin Sebor via Gcc-patches wrote:
The code that computes the size of an access to an object in
-Wuninitialized is limited to declared objects and so doesn't
apply to allocated objects, and doesn't correctly account for
an offset into the object and the access size.  This causes
false positives.

The attached fix tested on x86_64-linux corrects this.

Martin

gcc-101494.diff

Correct uninitialized object offset and size computation [PR101494].

Resolves:
PR middle-end/101494 - -uninitialized false alarm with memrchr of size 0

gcc/ChangeLog:

        PR middle-end/101494
        * tree-ssa-uninit.c (builtin_call_nomodifying_p):
        (check_defs):
        (maybe_warn_operand):

gcc/testsuite/ChangeLog:

        PR middle-end/101494
        * gcc.dg/uninit-38.c:
        * gcc.dg/uninit-41.c: New test.
        * gcc.dg/uninit-pr101494.c: New test.
OK once you complete the ChangeLog entry for the tree-ssa-uninit.c change.  Note this change only modifies maybe_warn_operand.

Whoops.  Fixed and pushed in r12-2583.

Martin

Reply via email to