This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/24875] New: [gfortran] Arithmetic overflow during compilation
- From: "martin at mpa-garching dot mpg dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Nov 2005 13:05:53 -0000
- Subject: [Bug fortran/24875] New: [gfortran] Arithmetic overflow during compilation
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The current mainline gfortran aborts compilation with an error for the code
below:
module mod1
implicit none
integer, parameter :: gndp = kind(1.0d0)
real(kind = gndp), parameter :: GNDP_MAX = huge(0.0_gndp)
end module mod1
module mod2
use mod1
implicit none
contains
subroutine foo()
real(kind = GNDP) :: val
val = -GNDP_MAX
end subroutine
end module mod2
~/tmp>gfortran -c -v huge.f90
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: /scratch/gcc/configure --quiet
--prefix=/afs/mpa/data/martin/ugcc --enable-languages=c++,fortran
--with-gmp=/afs/mpa/data/martin/mygmp
Thread model: posix
gcc version 4.1.0 20051115 (experimental)
/afs/mpa/data/martin/ugcc/libexec/gcc/i686-pc-linux-gnu/4.1.0/f951 huge.f90
-quiet -dumpbase huge.f90 -mtune=pentiumpro -auxbase huge -version -o
/tmp/ccjkyE0d.s
GNU F95 version 4.1.0 20051115 (experimental) (i686-pc-linux-gnu)
compiled by GNU C version 4.1.0 20051115 (experimental).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
In file huge.f90:15
val = -GNDP_MAX
1
Error: Arithmetic overflow at (1)
I'm not entirely sure that this is a bug, since it could be the case that
-GNDP_MAX cannot be represented as a real(gndp).
But, on the other hand, the following code compiles without problems:
module mod1
implicit none
integer, parameter :: gndp = kind(1.0d0)
real(kind = gndp), parameter :: GNDP_MAX = huge(0.0_gndp)
contains
subroutine foo()
real(kind = GNDP) :: val
val = -GNDP_MAX
end subroutine
end module mod1
--
Summary: [gfortran] Arithmetic overflow during compilation
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: martin at mpa-garching dot mpg dot de
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24875