------- 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