This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
problem with integer kind
- From: Andrea Negri <negri dot andre at gmail dot com>
- To: fortran at gcc dot gnu dot org
- Date: Sun, 17 Jun 2012 13:35:15 +0200
- Subject: problem with integer kind
Dear all,
I have compiled the newer version of gcc (4.7.1), with the support for
c++ and fortran.
I have done a very simple test of the integer "double" precision
(although it's a bit incorrect saying double integer precision) and
the compiler refuses to compile!
The program is the following one:
PROGRAM kind_integer_test
?IMPLICIT NONE
?INTEGER, PARAMETER :: intprec=selected_int_kind(18)
?INTEGER(intprec) :: test_int
write(*,*) 'intprec=', intprec
! ?test write
write(*,*) 'test_int=', test_int
test_int = 9000000000
write(*,*) 'test_int=', test_int
END PROGRAM
The selected_int_kind(18) should ensure that the test_int variable is
large enough to contain an integer value of 10^18.
I have compiled it with
gfortran -o run.exe program.f90 ? -std=f95
and the result is :
program.f90:8.21:
test_int = 9000000000
? ? ? ? ? ? ? ? ? ? 1
Error: Integer too big for its kind at (1). This check can be disabled
with the option -fno-range-check
If I compile with the option -fno-range-check everything is ok, the
compiler should understand that the variable test_int is not a default
integer variable.
Could it be a bug of the the compiler?
Thanks to everyone,
Andrea Negri