https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89696
Bug ID: 89696
Summary: A potential bug with read() when parsing number from
string
Product: gcc
Version: 8.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libfortran
Assignee: unassigned at gcc dot gnu.org
Reporter: kevin at fai dot host
Target Milestone: ---
For this bug I report, I report two bugs. One could be a potential bug while
the other should for certainly be a bug. These bugs affect both, gfortran
version 7.3.0 and gfortran version 8.2.0.
Bug one(Potential bug):
When using the read() procedure for parsing a string to an integer type,
strings, where valid digits follow by whitespaces and then any other character,
are parsable. I don't think they should be parsable as those strings are not
valid number strings. For example:
1. " 12 b " >> will become 12
2. " 124 c " >> will become 124
Bug two:
It is not possible to assign the lowest value to any integer type without
having no range check disable as the compiler will give false warning. For
example -2147483648 can't be assigned to int32, -9223372036854775808 can't be
assigned to int64, and -170141183460469231731687303715884105728 couldn't be
assigned to int128.