https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128453
--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Richard Biener <[email protected]>: https://gcc.gnu.org/g:a2d7bbb3494b789291d90d89e865b5ff063493e4 commit r17-6314-ga2d7bbb3494b789291d90d89e865b5ff063493e4 Author: Richard Biener <[email protected]> Date: Thu Nov 5 11:53:55 2026 +0100 tree-optimization/128453 - avoid truncating pow exponents in reassoc acceptable_pow_call accepts any integral pow exponent that fits a HOST_WIDE_INT, but the exponent is recorded in operand_entry::count, which is an unsigned int, so for example pow (x, 4294967296.0) gets a count of zero. attempt_builtin_powi then removes that entry from the operand list for free, dropping the pow call from the product entirely. Likewise the accumulated occurrence count of a factor is used as the int exponent of __builtin_powi without checking it fits. Widen operand_entry::count to HOST_WIDE_INT, reject exponents in acceptable_pow_call that do not fit the exponent argument type of __builtin_powi, avoid overflowing the accumulated occurrence counts and split powers exceeding the range of the __builtin_powi exponent argument over multiple calls. PR tree-optimization/128453 * tree-ssa-reassoc.h (operand_entry::count): Change type to HOST_WIDE_INT. * tree-ssa-reassoc.cc (acceptable_pow_call): Reject exponents not fitting integer_type_node. (attempt_builtin_powi): Record a factor in a separate element when accumulating its occurrence count would overflow. Limit the power of __builtin_powi calls to the maximum value of integer_type_node. * gcc.dg/pr128453-1.c: New testcase. * gcc.dg/pr128453-2.c: Likewise.
