------- Comment #5 from jvdelisle at gcc dot gnu dot org  2007-03-18 02:22 
-------
Heres the real problem:

Try compiling this with and without -fno-range-check.

      integer*8  :: k= 68719476746
      integer*8  :: k2 = 2_8**36 + 10
      print *, "k=",k, k2, int(k2, kind=8), int(k2, kind=4)
      end

With checking:

overflow.f:1.34:

      integer*8  :: k= 68719476746                                      
                                 1
Error: Integer too big for its kind at (1)

Without checking:

$ gfc -fno-range-check overflow.f 
$ ./a.out
 k=          68719476746          68719476746          68719476746          10

So our range checking does not catch the case when too big integer is hidden in
some arithmetic and conversion of kinds does not either.

I don't think we want integer kind conversion to catch this, its no different
then a cast.  The programmer needs to be aware of what they are doing.

In tha case of the overly large unit number, We do catch non disguised cases.

Any opinions on whether we need to really 'fix' this?  (I am not taking sides
here, the answer too my question has broader implications, ie int intrinsics)


-- 


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

Reply via email to