[Patch, fortran] PR28105 Overflow check for memory allocation
Steve Kargl
sgk@troutmask.apl.washington.edu
Tue Dec 14 07:09:00 GMT 2010
On Mon, Dec 13, 2010 at 11:06:08PM +0200, Janne Blomqvist wrote:
> Hi,
>
> as a result of a recent commit, size_t in the gfortran frontend is now
> properly an unsigned type. As a side-effect of this, testing whether a
> value of type size_t is negative just generates dead code which is
> optimized away. This kind of test was previously used as a crude kind
> of overflow check for memory allocation (for the ALLOCATE statement
> there is now a proper implementation).
>
> The attached patch removes the generation of this dead code in the first place.
>
> Regtested on x86_64-unknown-linux-gnu, Ok for trunk?
>
OK.
Just out of curiousity, your error message is now "Out of memory".
If someone's shell restricts that amount of memory allowed to be
allocate, one could run into an allocation issue even though the
system has memory available. Won't a better error message be
"memory allocation issue"?
--
Steve
More information about the Gcc-patches
mailing list