public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/30528]  New: INTEGER(2) overflow
@ 2007-01-21 18:23 remi dot mommsen at gmx dot net
  2007-01-21 20:11 ` [Bug fortran/30528] " jvdelisle at gcc dot gnu dot org
  2007-01-21 20:15 ` fxcoudert at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: remi dot mommsen at gmx dot net @ 2007-01-21 18:23 UTC (permalink / raw)
  To: gcc-bugs

These lines cannot be compiled with gfortran (GNU Fortran 95 (GCC) 4.2.0
20070117 (prerelease)) on a Mac OS X 10.4 (powerpc): 

      INTEGER*2 IWD1
      IWD1 = 32768
      END

It fails with

      IWD1 = 32768
            1
Error: Arithmetic overflow converting INTEGER(4) to INTEGER(2) at (1)


This works for g77 (GNU Fortran (GCC) 3.4.3) as well as with gfortran (and g77)
on Mac OS X 10.4 on intel (i686-apple-darwin8).

All fortran compilers have been compiled within the Fink framework.


-- 
           Summary: INTEGER(2) overflow
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: remi dot mommsen at gmx dot net
 GCC build triplet: powerpc-apple-darwin8
  GCC host triplet: powerpc-apple-darwin8
GCC target triplet: powerpc-apple-darwin8


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


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

* [Bug fortran/30528] INTEGER(2) overflow
  2007-01-21 18:23 [Bug fortran/30528] New: INTEGER(2) overflow remi dot mommsen at gmx dot net
@ 2007-01-21 20:11 ` jvdelisle at gcc dot gnu dot org
  2007-01-21 20:15 ` fxcoudert at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-01-21 20:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jvdelisle at gcc dot gnu dot org  2007-01-21 20:11 -------
The largest positive integer that can be represented by that kind type is
32767, so gfortran is correctly reporting an error.

Use -fno-range-check to bypass this.


-- 

jvdelisle at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING


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


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

* [Bug fortran/30528] INTEGER(2) overflow
  2007-01-21 18:23 [Bug fortran/30528] New: INTEGER(2) overflow remi dot mommsen at gmx dot net
  2007-01-21 20:11 ` [Bug fortran/30528] " jvdelisle at gcc dot gnu dot org
@ 2007-01-21 20:15 ` fxcoudert at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-01-21 20:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from fxcoudert at gcc dot gnu dot org  2007-01-21 20:14 -------
First, it should be noted that it's not legal code. Indeed, you might (or not)
be surprised by the behaviour of the code in question:

pito /tmp $ cat a.f 
      INTEGER*2 IWD1
      IWD1 = 32768
      PRINT *, IWD1
      END
pito /tmp $ g77 a.f && ./a.out
 -32768

This check is new in gfortran, the behaviour is intentional but can be
specificaly disabled using -fno-range-check:

$ gfortran -fno-range-check a.f && ./a.out
 -32768


Closing bug report as INVALID. Making note to document this in the release
notes.


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
  GCC build triplet|powerpc-apple-darwin8       |
   GCC host triplet|powerpc-apple-darwin8       |
 GCC target triplet|powerpc-apple-darwin8       |
         Resolution|                            |INVALID


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


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

end of thread, other threads:[~2007-01-21 20:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-21 18:23 [Bug fortran/30528] New: INTEGER(2) overflow remi dot mommsen at gmx dot net
2007-01-21 20:11 ` [Bug fortran/30528] " jvdelisle at gcc dot gnu dot org
2007-01-21 20:15 ` fxcoudert at gcc dot gnu dot 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).