This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/31538] misleading bounds check error



------- Comment #7 from kargl at gcc dot gnu dot org  2010-04-16 16:14 -------
(In reply to comment #6)
> (In reply to comment #5)
> > Newly created test case. Expected:
> > * Extend (size) should be printed for "a = f()", as NAG f95 does
> > 
> > (I'm not sure that "different shape" is correct for the current a=b message;
> > additionally, the A should not be capitalized and the D in different should.)
> > 
> > 
> >  integer :: a(-4:1), b(0:4)
> >  b = 5
> > ! a(-4:1) = b(0:4) ! Error: different shape for Array
> > !                  ! assignment at (1) on dimension 1 (6/5)
> > !
> > ! gfortran: Array bound mismatch for dimension 1 of array 'f'
> > ! NAG f95:  Rank 1 of array operand has extent 5 instead of 2
> >  a(i:1) = f(b)
> > contains
> >   function f(x)
> >     integer :: x(:),f(size(x))
> >     f = x
> >   end function
> > end
> > 
> 
> The above is clearly invalid, so gfortran can go anything 
> it wants.
> 
> laptop:kargl[236] gfc4x -o z -fcheck=all g.f90 -Wuninitialized 
> g.f90: In function 'MAIN__':
> g.f90:8:0: warning: 'i' may be used uninitialized in this function
> 

Assuming 'i = -4' is missing in the programming, why is the 
runtime bounds check not a sufficient error message?  IMHO,
I think this pr can be closed.


-- 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]