[Bug fortran/125458] [13/14/15/16/17 Regression] Constant integer overflow not detected

"tkoenig at gcc dot gnu.org via Gcc-bugs" <[email protected]> Sat, 01 Aug 2026 07:45:01 +0000
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125458

--- Comment #19 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
(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.