[Bug fortran/33285] integer too big compile error in gfortran
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33285 Andrew Pinski pinskia at gcc dot gnu.org changed: What|Removed |Added CC||jayas at hvdc dot ca --- Comment #7 from Andrew Pinski pinskia at gcc dot gnu.org 2013-05-02 19:19:16 UTC --- *** Bug 57148 has been marked as a duplicate of this bug. ***
[Bug fortran/33285] integer too big compile error in gfortran
--- Comment #1 from jvdelisle at gcc dot gnu dot org 2007-09-02 20:57 --- This is assuming that an asymmetric range is permitted in Fortran which I think it is not. You can use -fno-range-check to disable this check. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33285
[Bug fortran/33285] integer too big compile error in gfortran
--- Comment #2 from kargl at gcc dot gnu dot org 2007-09-02 21:04 --- The number 2147483648 is too big. The minus sign is a unary operator. Either use the compiler option that Jerry mentioned or use 'k = - huge(k) - 1' -- kargl at gcc dot gnu dot org changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution||INVALID http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33285
[Bug fortran/33285] integer too big compile error in gfortran
--- Comment #3 from jlaw at uoguelph dot ca 2007-09-03 01:50 --- (In reply to comment #1) This is assuming that an asymmetric range is permitted in Fortran which I think it is not. You can use -fno-range-check to disable this check. In the IBM XL Fortran 90 manual: pg 19 I quote: for Integer Kind parameter 4 range of value -2147483648 through to 2147483647 namely -(2^31) to (2^31 -1) Compiling this using gcc-gfortran-4.1.X and gcc-g77-3.X works It is a Fortran standard! -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33285
[Bug fortran/33285] integer too big compile error in gfortran
--- Comment #4 from jlaw at uoguelph dot ca 2007-09-03 02:32 --- (In reply to comment #2) The number 2147483648 is too big. The minus sign is a unary operator. Either use the compiler option that Jerry mentioned or use 'k = - huge(k) - 1' option: -fno-range-check is supposed to be the default for the compiler In some cases, options have positive and negative forms; the negative form of -ffoo would be -fno-foo. This manual documents only one of these two forms, whichever one is not the default.' It is in 4.1.X, looks like it has changed in 4.2.1 In using this option: 4.2.1 compiles the test code. This change from the default is NOT documented. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33285
[Bug fortran/33285] integer too big compile error in gfortran
--- Comment #5 from kargl at gcc dot gnu dot org 2007-09-03 03:43 --- (In reply to comment #4) (In reply to comment #2) The number 2147483648 is too big. The minus sign is a unary operator. Either use the compiler option that Jerry mentioned or use 'k = - huge(k) - 1' option: -fno-range-check is supposed to be the default for the compiler Huh? No, the default for the compiler is to perform range checking. In some cases, options have positive and negative forms; the negative form of -ffoo would be -fno-foo. This manual documents only one of these two forms, whichever one is not the default.' Looks like a bug in the documentation. I'll fix that shortly. It is in 4.1.X, looks like it has changed in 4.2.1 There was a bug in gfortran that allowed it to accepted -2147483648. I fixed the bug with 2006-09-07 Steven G. Kargl [EMAIL PROTECTED] * gfortran.h (gfc_integer_info): Eliminate max_int. * arith.c (gfc_arith_init_1): Remove initialization of max_int. (gfc_arith_done_1): Remove clearing of max_int. (gfc_check_integer_range): Fix range chekcing of overflow. * simplify.c (gfc_simplify_not): Construct mask that was max_int. You can read about the problem here: http://gcc.gnu.org/ml/fortran/2006-09/msg8.html -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33285
[Bug fortran/33285] integer too big compile error in gfortran
--- Comment #6 from kargl at gcc dot gnu dot org 2007-09-03 03:58 --- (In reply to comment #3) (In reply to comment #1) This is assuming that an asymmetric range is permitted in Fortran which I think it is not. You can use -fno-range-check to disable this check. In the IBM XL Fortran 90 manual: pg 19 I quote: for Integer Kind parameter 4 range of value -2147483648 through to 2147483647 namely -(2^31) to (2^31 -1) The IBM XL manual isn't the Fortran standard. Compiling this using gcc-gfortran-4.1.X and gcc-g77-3.X works It was a bug in older versions of gfortran. It is a Fortran standard! The Fortran 95 standard doesn't specify the values that an integer can take. It does specify the model numbers for integer. There is a difference! In i = - 2147483648, the RHS is an expression. It is a unary minus operator with the operand 2147483648, which is greater than 2^31-1. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33285