This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, fortran] PR29451 - Fortran runtime error: Attempt to allocate a negative amount of memory...]
- From: Paul Thomas <paulthomas2 at wanadoo dot fr>
- To: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- Cc: patch <gcc-patches at gcc dot gnu dot org>, "'fortran at gcc dot gnu dot org'" <fortran at gcc dot gnu dot org>, FranÃois-Xavier Coudert <fxcoudert at gmail dot com>
- Date: Tue, 17 Oct 2006 00:05:15 +0200
- Subject: Re: [Patch, fortran] PR29451 - Fortran runtime error: Attempt to allocate a negative amount of memory...]
- References: <4533A4AE.3040500@wanadoo.fr> <20061016164040.GB56743@troutmask.apl.washington.edu>
Steve and FX
The above patch regtested cleanly on a tree that pre-dated FX's bounds
patch. However, in regtesting prior to commit, I ran into a failure
because the second ubound of 'soda' in the submitted testcase,
negative_automatic_size.f90, was being returned as zero. Other
compilers do not do this to the ubound of an automatic array and return
the given values instead.
Looking further, I find that
print *, ubound (soda, 1), ubound (soda, 2)
print *, ubound (soda)
outputs on the first call to the procedure:
0 2
0 0
So, I think something is not right with the vector version of ubound for
this case.
Since I am convinced that this patch is doing the right thing, I have
replaced
if (.not.any(lbound (soda) <= ubound (soda))) call abort ()
with what should be the equivalent
if ((lbound (soda, 1) > ubound (soda, 1)) .and. &
(lbound (soda, 2) > ubound (soda, 2))) call abort ()
All the best
Paul