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

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Torbjorn Svensson <[email protected]>:

https://gcc.gnu.org/g:c5627f93a8259131da2cdebee6d9b0e1f2de1a60

commit r17-2365-gc5627f93a8259131da2cdebee6d9b0e1f2de1a60
Author: Torbjörn SVENSSON <[email protected]>
Date:   Sun Jul 12 20:42:55 2026 +0200

    Make -Wuse-after-free alias for -Wuse-after-free=1 [PR124058]

    GCC currently treats -Wuse-after-free and -Wuse-after-free= as separate
    options internally, with OPT_Wuse_after_free for no argument and
    OPT_Wuse_after_free_ with argument.  Make -Wuse-after-free an alias for
    -Wuse-after-free=1 so both forms go through the same option code.

    Switch the warning and suppression sites to OPT_Wuse_after_free_ so
    pragmas, diagnostic classification, and suppression all refer to the same
    option.

    Document that -Wuse-after-free is equivalent to -Wuse-after-free=1.

    On Arm AAPCS targets, constructors and destructors return this.  In
    maybe_prepare_return_this, suppressing OPT_Wuse_after_free for this records
    the suppression under NW_OTHER, since OPT_Wuse_after_free is not explicitly
    mapped to a diagnostic group.  That can suppress unrelated NW_OTHER
    warnings, such as -Wdeprecated-declarations.  OPT_Wuse_after_free_ is
    mapped to NW_DANGLING, so using it keeps the suppression scoped to the
    use-after-free warning.

            PR driver/124058

    gcc/ChangeLog:

            * common.opt (Wuse-after-free): Make an alias for
            -Wuse-after-free=1.
            * doc/invoke.texi: Document alias.
            * gimple-ssa-warn-access.cc (pass_waccess::warn_invalid_pointer):
            Use OPT_Wuse_after_free_.

    gcc/cp/ChangeLog:

            * decl.cc (maybe_prepare_return_this): Use OPT_Wuse_after_free_.

    gcc/testsuite/ChangeLog:

            * c-c++-common/Wuse-after-free-8.c: New test.

    Signed-off-by: Torbjörn SVENSSON <[email protected]>

Reply via email to