public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/57148] New: integer*4 fails to read largest negative number
@ 2013-05-02 19:13 jayas at hvdc dot ca
  2013-05-02 19:19 ` [Bug fortran/57148] " pinskia at gcc dot gnu.org
  2013-05-02 20:03 ` kargl at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: jayas at hvdc dot ca @ 2013-05-02 19:13 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57148

             Bug #: 57148
           Summary: integer*4 fails to read largest negative number
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jayas@hvdc.ca


I am using MINGW32 build of GCC 4.6.2 on Windows 7 x64.

Range of integer*4 is from -2147483648 to +2147483647. If you try to assign
-2147483648 to an integer*4 variable, it gives an error saying too big for its
kind.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug fortran/57148] integer*4 fails to read largest negative number
  2013-05-02 19:13 [Bug fortran/57148] New: integer*4 fails to read largest negative number jayas at hvdc dot ca
@ 2013-05-02 19:19 ` pinskia at gcc dot gnu.org
  2013-05-02 20:03 ` kargl at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-05-02 19:19 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57148

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2013-05-02 19:19:16 UTC ---
You are wrong in saying the range is -2147483648 to +2147483647.  In fortran
the range is symmetrical around 0.

*** This bug has been marked as a duplicate of bug 33285 ***


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug fortran/57148] integer*4 fails to read largest negative number
  2013-05-02 19:13 [Bug fortran/57148] New: integer*4 fails to read largest negative number jayas at hvdc dot ca
  2013-05-02 19:19 ` [Bug fortran/57148] " pinskia at gcc dot gnu.org
@ 2013-05-02 20:03 ` kargl at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: kargl at gcc dot gnu.org @ 2013-05-02 20:03 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57148

kargl at gcc dot gnu.org changed:

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

--- Comment #2 from kargl at gcc dot gnu.org 2013-05-02 20:02:58 UTC ---
(In reply to comment #1)
> You are wrong in saying the range is -2147483648 to +2147483647.  In fortran
> the range is symmetrical around 0.
> 
> *** This bug has been marked as a duplicate of bug 33285 ***

Not quite right.  The model numbers imply a symmetric range.
It is processor dependent on whether the most negative
value is -2147483648.  Without see the source, it's difficult
to say what OP hit. If her/his code is equivalent to

program foo
  integer i
  read(*,*) i
  print *, i
end program foo

update to 4.8. or trunk.  

This is trunk.
% gfc4x -o foo foo.f90
% ./foo
-2147483648 
 -2147483648

This is 4.7.something_revision.
gfc47 -o foo foo.f90
troutmask:sgk[214] ./foo
-2147483648 
At line 3 of file foo.f90 (unit = 5, file = 'stdin')
Fortran runtime error: Integer overflow while reading item 1

If OP tries a simple assignment he/she will hit an issue
with a unary minus operator.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-05-02 20:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-02 19:13 [Bug fortran/57148] New: integer*4 fails to read largest negative number jayas at hvdc dot ca
2013-05-02 19:19 ` [Bug fortran/57148] " pinskia at gcc dot gnu.org
2013-05-02 20:03 ` kargl at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).