https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89696

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #4 from kargl at gcc dot gnu.org ---
(In reply to Khang H. Nguyen from comment #3)
> Sorry, I just have one more quick question.
> 
> Bug 1:
> Nonetheless, for read(), I was just wondering, if you read from a list input
> then it should be like that. 
> 
> However, if it is just a raw string and it acted like that, then how do you
> tell if a string is an invalid integer string?

Formatted input will tell you that you have a problem.

% cat a.f90
program foo
  integer i
  read(*,*) i
  read(*,'(I4)') i
end program foo

% gfcx -o z a.f90
% ./z
% ./z
12 b
12 b
At line 4 of file a.f90 (unit = 5, file = 'stdin')
Fortran runtime error: Bad value during integer read

The first '12 b' is read a '12'.  The second read says the 4 characters
are an integer, so '12 b' generates an error.

> Do you have to build a check for that then? Shouldn't read() be able to
> detect that because if you build a check on top of that, you would have to
> go through all the character one and then read would then goes through all
> the characters again.
> 
> Bug 2:
> As you said that it is not a bug. I just suggested that for -2147483648, it
> is still assignable with range check on, you just have to assign -2147483647
> - 1

Yes, you can assign -2147483647 - 1.  As Thomas suggested, the first
minus sign is a unary operator and the second minus sign is a binary
operator.  So, there are two operators in the expression.

Reply via email to