------- Comment #5 from kargl at gcc dot gnu dot org  2009-04-15 17:43 -------
(In reply to comment #4)
> > But, it does not do
> > what you expected!  Try using your allocated array in something
> > other than SIZE().
> 
> It's doing exactly what I expect... including the size intrinsic returning a
> garbage result because it returns a default integer.
> 
> > cat test.f90
> INTEGER*8 :: N
> INTEGER, DIMENSION(:), ALLOCATABLE :: data
> N=2_8**32
> write(6,*) N
> ALLOCATE(data(N))
> data(1:N)=0
> write(6,*) SIZE(data,1)
> END
> > gfortran -O2 -fbounds-check test.f90
> > ./a.out
>            4294967296
>            0
> 

Damn.  I was in the wrong xterm, which was a i686 system
not my usual x86_64.  I looked at the wrong dump.  You're
correct that size is doing something stupid.  From the
dump

    logical(kind=4) D.1539;                    <-- This wrong.
    integer(kind=8) size.2;
    integer(kind=8) D.1537;

    data.dtype = 265;
    data.dim[0].lbound = 1;
    data.dim[0].ubound = n;
    data.dim[0].stride = 1;
    D.1537 = NON_LVALUE_EXPR <MAX_EXPR <n, 0>>;
    D.1539 = NON_LVALUE_EXPR <n> <= 0;       <--- because this triggers
    if (D.1539)                              <--- this.
      {
        size.2 = 0;
      }


-- 

kargl at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-04-15 17:43:49
               date|                            |


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

Reply via email to