https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109511
Bug ID: 109511
Summary: incorrectly rejects set_exponent with constant
negative exponent
Product: gcc
Version: 12.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: sebastien at debian dot org
Target Milestone: ---
The following program fails to compile:
program exponent
print *, set_exponent(1., -1)
end program exponent
With the following error message:
exponent.f08:2:24:
2 | print *, set_exponent(1., -1)
| 1
Error: Result of SET_EXPONENT overflows its kind at (1)
But as I understand it, this is a valid program.
Note that the problem does not occur if the exponent is positive. It also does
not occur if the exponent is variable (even with a negative value). So it looks
like the static analyzer is overly restrictive.