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

albert at tugraz dot at via Gcc-bugs <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125458

Christopher Albert <albert at tugraz dot at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |albert at tugraz dot at,
                   |                            |jvdelisle at gcc dot gnu.org

--- Comment #17 from Christopher Albert <albert at tugraz dot at> ---
Open for review, comments welcome:
https://github.com/lazy-fortran/gcc/pull/43

Root cause: since 57b474bc42dc (the PR84734 error-recovery change),
eval_intrinsic keeps the out-of-range constant for recovery and only
buffers the overflow error. A successful statement match can then
discard the buffered diagnostic while the invalid constant survives,
so the overflow compiles silently. The fix makes eval_intrinsic emit
the range-checked overflow error immediately outside unsigned mode
instead of buffering it, keeping the recovery result without losing
the diagnostic. dg-error test included; check-fortran and the libgomp
Fortran suite are clean.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.