GCC Newspaper
JULY 29, 2026
Date
/
Architectures
Components
Topics
News & Policy
gcc

Make -Wuse-after-free an alias for -Wuse-after-free=1

Standardizes -Wuse-after-free warning handling by making it an alias for a specific option instance.

This commit unifies the handling of the -Wuse-after-free warning. It makes the flag an alias for -Wuse-after-free=1, ensuring that both the bare flag and the version with an argument are processed identically. This change simplifies internal option management, directs pragmas and suppressions to the correct diagnostic group, and updates documentation.

In Details

GCC previously distinguished between OPT_Wuse_after_free (no argument) and OPT_Wuse_after_free_ (with argument) internally. This commit refactors this by making OPT_Wuse_after_free an alias for OPT_Wuse_after_free=1. All sites that issue or suppress this warning, including testsuite pragmas and the diagnostic classification infrastructure, are updated to use OPT_Wuse_after_free_. This aligns suppression behavior (e.g., ensuring NW_OTHER suppressions are correctly mapped to NW_DANGLING for use-after-free warnings on targets like ARM AAPCS) and simplifies the management of this sp…

For Context
-Wuse-after-free
A GCC warning flag that detects potential use-after-free errors in C and C++ code. This commit makes it an alias for -Wuse-after-free=1.
common.opt
A file within the GCC source tree that defines command-line options, their properties, and how they are processed by the compiler.
OPT_Wuse_after_free_
The internal GCC option code representing the -Wuse-after-free warning when it takes an argument. This commit standardizes its usage.
diagnostic group
A category or classification for compiler warnings and errors, used for controlling which diagnostics are reported or suppressed. NW_DANGLING is such a group for use-after-free issues.
ARM AAPCS
The Application Procedure Call Standard for the ARM architecture. It defines conventions for how functions pass arguments and return values, which can impact how certain warnings are reported and suppressed.
Filed Under: diagnosticscompiler internals