This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/31538] misleading bounds check error
- From: "kargl at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 Apr 2010 16:14:17 -0000
- Subject: [Bug fortran/31538] misleading bounds check error
- References: <bug-31538-13404@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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