https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118224
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:804e9d55d9e54cffd32d8dd065bf3c785b1edbf4 commit r15-6566-g804e9d55d9e54cffd32d8dd065bf3c785b1edbf4 Author: Jakub Jelinek <ja...@redhat.com> Date: Mon Jan 6 10:12:00 2025 +0100 tree-ssa-dce: Punt on allocations with too large constant sizes [PR118224] As suggested by Richi in the PR, the following patch will fail to DCE allocation calls if they have constant size which is too large (over PTRDIFF_MAX), or for the case of calloc, if either of the arguments is too large (in that case in theory the call could succeed if the other argument is variable zero but who cares) or if both are constant and their product overflows or is above PTRDIFF_MAX. This will make some pedantic conformance tests happy, though if one hides the size one will still need to use -fno-malloc-dce or obfuscate even the malloc etc. uses. If the size is constant and too large, it isn't worth trying to optimize it. 2025-01-06 Jakub Jelinek <ja...@redhat.com> PR tree-optimization/118224 * tree-ssa-dce.cc (is_removable_allocation_p): Don't return true for allocations with constant size argument larger than PTRDIFF_MAX or for calloc with one of the arguments constant larger than PTRDIFF_MAX or their product known constant above PTRDIFF_MAX. Fix comment typos, furhter -> further and then -> than. * lto-section-in.cc (lto_free_function_in_decl_state_for_node): Fix comment typo, furhter -> further. * gcc.dg/pr118224.c: New test. * c-c++-common/ubsan/vla-1.c (bar): Use noipa attribute instead of noinline, noclone.