[Bug fortran/35719] pointer to zero sized array not associated
burnus at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Mon May 5 05:47:00 GMT 2008
------- Comment #3 from burnus at gcc dot gnu dot org 2008-05-05 05:46 -------
(In reply to comment #2)
> The problem is that we set ila1 to a null pointer if its
> size is zero: [...]
> It isn't clear to me why we do this (maybe as a debugging aid?).
Well, if we don't assign anything, the memory content is not well defined.
Doing than associated(ptr[, otherPtr]) gives then a random result including
not-associated. Currently, ptr.data == NULL -> unassociated and ptr.data !=
NULL => associated works well, except for zero-sized arrays.
One possibility is to allocate something for zero-sized arrays, e.g. one
element. The array bounds ensure than that the program still knows that the
size of the array is zero. The extra allocation wastes memory, but usually one
element is quite small and zero-sized arrays are not very common.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35719
More information about the Gcc-bugs
mailing list