[Bug fortran/125458] [13/14/15/16/17 Regression] Constant integer overflow not detected
albert at tugraz dot at
gcc-bugzilla@gcc.gnu.org
Sat Aug 1 17:59:17 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125458
--- Comment #21 from Christopher Albert <albert at tugraz dot at> ---
(In reply to tkoenig@gcc.gnu.org from comment #19)
> (In reply to Christopher Albert from comment #18)
> > Created attachment 65181 [details]
> > 0001-fortran-Preserve-overflow-diagnostics-during-matchin.patch
> >
> > Emit range-checked overflow diagnostics immediately outside unsigned mode so
> > a successful statement match cannot discard the error while retaining the
> > invalid constant. This is narrower than deferring all matching arithmetic.
> > A diagnostic test covers multiplication and addition. check-fortran and the
> > libgomp Fortran suites are clean.
>
> This looks good in principle (and is below the 15-line limit for AI-assisted
> content), but overflow behavior of signed types should not depend
> on the setting of -funsigned.
The revised patch drops the flag_unsigned condition, so signed overflow
diagnostics no longer depend on -funsigned. A test covers signed overflow
with -frange-check -funsigned. Two unsigned arithmetic tests now use
representable signed reference expressions.
check-fortran passes with only the documented bessel_6 failures.
check-target-libgomp-fortran passes with no FAIL or XPASS.
More information about the Gcc-bugs
mailing list