https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109804

--- Comment #16 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Andrew Pinski
<pins...@gcc.gnu.org>:

https://gcc.gnu.org/g:16319f8fba6c049d743046488588f40da2349048

commit r12-10432-g16319f8fba6c049d743046488588f40da2349048
Author: Andrew Pinski <quic_apin...@quicinc.com>
Date:   Wed Feb 21 20:12:21 2024 -0800

    warn-access: Fix handling of unnamed types [PR109804]

    This looks like an oversight of handling DEMANGLE_COMPONENT_UNNAMED_TYPE.
    DEMANGLE_COMPONENT_UNNAMED_TYPE only has the u.s_number.number set while
    the code expected newc.u.s_binary.left would be valid.
    So this treats DEMANGLE_COMPONENT_UNNAMED_TYPE like we treat function
paramaters
    (DEMANGLE_COMPONENT_FUNCTION_PARAM) and template paramaters
(DEMANGLE_COMPONENT_TEMPLATE_PARAM).

    Note the code in the demangler does this when it sets
DEMANGLE_COMPONENT_UNNAMED_TYPE:
          ret->type = DEMANGLE_COMPONENT_UNNAMED_TYPE;
          ret->u.s_number.number = num;

    Committed as obvious after bootstrap/test on x86_64-linux-gnu

            PR tree-optimization/109804

    gcc/ChangeLog:

            * gimple-ssa-warn-access.cc (new_delete_mismatch_p): Handle
            DEMANGLE_COMPONENT_UNNAMED_TYPE.

    gcc/testsuite/ChangeLog:

            * g++.dg/warn/Wmismatched-new-delete-8.C: New test.

    Signed-off-by: Andrew Pinski <quic_apin...@quicinc.com>
    (cherry picked from commit 1076ffda6ce5e6d5fc9577deaf8233e549e5787a)

Reply via email to