[patch, fortran] Fix PR 35719
Thomas Koenig
tkoenig@netcologne.de
Wed May 7 19:26:00 GMT 2008
Hello world,
the bug, discovered by Dick Hendrickson, was caused by using a null
pointer as return value when trying to malloc 0 bytes. This caused the
ASSOCIATED function to fail when applied to a pointer to an automatic
array. The approach in this patch is to allocate at least one byte
for each malloc, so the comparison of the pointers can be meaningful.
Regression-tested on i686-pc-linux-gnu. OK for trunk?
Thomas
2008-05-07 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/35719
* trans.c (gfc_call_malloc): If size equals zero, allocate one
byte; don't return a null pointer.
2008-05-07 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/35719
* gfortran.dg/associated_5.f90: New test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p3.diff
Type: text/x-patch
Size: 1717 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20080507/712aa76f/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: associated_5.f90
Type: text/x-fortran
Size: 490 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20080507/712aa76f/attachment-0001.bin>
More information about the Fortran
mailing list