[Bug tree-optimization/106409] GCC with LTO: -Walloc-size-larger-than warning (argument 1 value ‘18...615’ (SIZE_MAX) exceeds maximum object size with new)
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Dec 14 20:24:47 GMT 2025
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106409
--- Comment #12 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Lewis Hyatt <lhyatt@gcc.gnu.org>:
https://gcc.gnu.org/g:8e23a9982fa4b885a27608825cbe326d61f20498
commit r16-6110-g8e23a9982fa4b885a27608825cbe326d61f20498
Author: Lewis Hyatt <lhyatt@gmail.com>
Date: Sun Dec 14 09:51:12 2025 -0500
middle-end: Fix spurious -Walloc-size-larger-than warning during LTO
[PR106409]
The implementation of -Walloc-size-larger-than has logic to avoid issuing
the warning for ::operator new[] calls emitted by the C++ front end, which
otherwise produce known false positives. The logic for suppressing the
warning only activates in the C++ front end, and so it does not prevent the
LTO front end from issuing the warning. Fix by applying the logic in all
cases.
gcc/ChangeLog:
PR tree-optimization/106409
* gimple-ssa-warn-access.cc (maybe_warn_alloc_args_overflow):
Adjust
comment for clarity, and augment check to work in LTO as well.
gcc/testsuite/ChangeLog:
PR tree-optimization/106409
* g++.dg/lto/pr106409_0.C: New test.
More information about the Gcc-bugs
mailing list