This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Patch, gfortran] Fix for PR 12703.
- From: Toon Moene <toon at moene dot indiv dot nluug dot nl>
- To: gcc-patches at gcc dot gnu dot org
- Cc: fortran at gcc dot gnu dot org
- Date: Wed, 29 Oct 2003 22:26:16 +0100
- Subject: [Patch, gfortran] Fix for PR 12703.
- Organization: Moene Computational Physics, Maartensdijk, The Netherlands
Fortran 90/95 and onwards allow zero-sized objects, so we should allow
allocating them.
Fixes PR 12703, but not 12704, which shows, among other things, that
MAXLOC doesn't work for zero-sized arrays.
The patch below was tested on powerpc-unknown-linux-gnu (bootstrap C and
f95, make -k check of f95 test suite only).
OK to apply ?
--
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
GNU Fortran 95: http://gcc.gnu.org/fortran/ (under construction)
2003-10-29 Toon Moene <toon@moene.indiv.nluug.nl>
PR fortran/12703
* runtime/memory.c (allocate_size): Allow allocation
of zero-sized objects.
*** memory.c.orig Fri Sep 19 21:46:45 2003
--- memory.c Wed Oct 29 19:12:11 2003
*************** allocate_size (void **mem, size_t size,
*** 267,280 ****
{
malloc_t *newmem;
- /* Don't try to allocate 0 bytes. Should never happen anyway. */
-
- if (size == 0)
- {
- runtime_error ("ALLOCATE: Cannot allocate 0 bytes.");
- abort ();
- }
-
if (!mem)
runtime_error ("Internal: NULL mem pointer in ALLOCATE.");
--- 267,272 ----