GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gcc/expr.cc

Remove Wstrict-overflow warning from maybe_optimize_sub_cmp_0

The compiler no longer warns about strict overflow in the maybe_optimize_sub_cmp_0 function.

The compiler generated a warning related to strict overflow in maybe_optimize_sub_cmp_0, a function that helps optimize subtraction and comparison operations. This commit removes that warning and its associated test case, as part of a larger effort to deprecate the -Wstrict-overflow warning.

In Details

This removes a call to warning_at for Wstrict-overflow inside maybe_optimize_sub_cmp_0 in gcc/expr.cc, along with the test case gcc.dg/Wstrict-overflow-25.c. The overflow warning was triggered during optimization of subtraction followed by comparison with zero. This is part of a larger cleanup of Wstrict-overflow usage.

For Context

Compilers sometimes perform optimizations that assume certain properties of arithmetic operations, such as the absence of integer overflows. The -Wstrict-overflow option controls whether the compiler should warn when such optimizations might lead to unexpected behavior if overflows do occur. This commit removes a specific instance of this warning in a function responsible for optimizing subtraction and comparison operations. The goal is to reduce the number of potentially noisy or irrelevant warnings.

Filed Under: optimizationwarningstrict overflow