This is the mail archive of the gcc-patches@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]

Re: [Patch, fortran] PR37735 - Allocatable components in vectors of derived types cause ICE on assignment


On Fri, Nov 28, 2008 at 07:47:32PM +0100, Toon Moene wrote:
> Steve Kargl wrote:
> 
> >But, I still don't see what distinction you're trying to draw between
> >-fbounds-check and -fcheck-size, because -fbounds-check correctly 
> >identifies the program is doing something that is possibly an error.
> >
> >        REAL A(10,10)
> >        A = 1.0
> >        CALL SUB(A,10)
> >        END
> >        SUBROUTINE SUB(A, N)
> >        REAL A(N, N)
> >        PRINT*,A(1,N*N)
> >        END
> >
> >With -fbounds-check, the above dies with a runtime error.  You then
> >fix your code:
> 
> Ah, yes - that's all real fine if that's the only 
> not-really-wrong-but-non-conformant array indexing.
> 
> Unfortunately, in my world, the real bugs (read: addressing outside the 
> extent of the array) are dwarfed by these non-bugs.
> 
> That's why I would like to have a separate option ...
> 

I guess we will need to agree to disagree on this point.  The
standard specific forbids indexing an array outside its 
bounds.

  6.2.2.1  Array elements
  The value of a subscript in an array element shall be within the
  bounds for that dimension.

I do not see how you can have a set of legal subscripts that allow
you to exceed the extent of the array.  I could be wrong, but you
have not shown such a case.  -fbounds-check will in all cases find
the extent violation except for the possible case of a bug in 
-fbound-checks.

But, as I said, if someone writes a -fcheck-size patch, I won't
object.  I just think that it add yet-another-redundant option 
to gfortran.

-- 
Steve


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