------- Additional Comments From ebotcazou at gcc dot gnu dot org 2004-08-31 17:27 ------- > You're replacing both sizeof(mallocArea_) and sizeof(mallocArea_*) with > a size based on sizeof(mallocArea_*) roundup up to the byte-version of > BIGGEST_ALIGNMENT. OK, I ssee that mallocArea is itself a pointer, so > in both cases the sizes you're replacing are the same. In any case, it > looks as though this patch is safe; at worst, we allocate some more memory.
Wait a minute... I didn't see that the original code (that is Bud's patch) contains a mix of sizeof(mallocArea_) and sizeof(mallocArea_*). This looks bogus to me, especially: @@ -388,6 +377,7 @@ malloc_new_inpool_ (mallocPool pool, mal void *ptr; mallocArea_ a; unsigned short i; + mallocArea_ *temp; if (pool == NULL) pool = malloc_pool_image (); @@ -397,11 +387,14 @@ malloc_new_inpool_ (mallocPool pool, mal || malloc_pool_find_ (pool, malloc_pool_image ())); #endif - ptr = malloc_new_ (s + (i = (MALLOC_DEBUG ? strlen (name) + 1 : 0))); + ptr = malloc_new_ (sizeof(mallocArea_*) + s + (i = (MALLOC_DEBUG ? strlen (name) + 1 : 0))); #if MALLOC_DEBUG strcpy (((char *) (ptr)) + s, name); #endif a = malloc_new_ (offsetof (struct _malloc_area_, name) + i); + temp = (mallocArea_ *) ptr; + *temp = a; + ptr = ptr + sizeof(mallocArea_*); switch (type) { /* A little optimization to speed up killing of non-permanent stuff. */ and happens to work only by accident. Could you enlighten us, Bud? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17180 ------- You are receiving this mail because: ------- You reported the bug, or are watching the reporter.