[Bug fortran/17912] New: gfortran: Bogus "Arithmetic overflow" error, regression w.r.t. g77

anlauf at hep dot tu-darmstadt dot de gcc-bugzilla@gcc.gnu.org
Sat Oct 9 16:19:00 GMT 2004


Hi,

this code fails to compile with gfortran, but compiles with g77
(and, needless to say, other compilers ;-)

      program gfcbug16
      integer i
      i = -2147483647 - 1
      print *, i
      end

I get:

 In file gfcbug16.f:3

      i = -2147483647 - 1                                               
         1
Error: Arithmetic overflow at (1)


Note that the integer constants are perfectly legal (so this is different
from bug report #13490), but gfortran sort of "optimizes" by calculating
the difference and then complains, even if compiling with -O0 -g.

I could live with a (suppressible) warning message, but throwing an error
clearly breaks legacy code.

Cheers,
-ha

-- 
           Summary: gfortran: Bogus "Arithmetic overflow" error, regression
                    w.r.t. g77
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: anlauf at hep dot tu-darmstadt dot de
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i686-pc-linux-gnu


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



More information about the Gcc-bugs mailing list