[Bug target/17180] [3.4 Regression] nearly all g77 tests fail
------- Additional Comments From bdavis at gcc dot gnu dot org 2004-09-01 01:15 -------
there is a mistake on line 308 of malloc.c:
diff -r1.12.14.1 malloc.c
308c308
< t = (mallocArea_ *) (ptr - sizeof(mallocArea_));
---
> t = (mallocArea_ *) (ptr - sizeof(mallocArea_ *));
i should have always used sizeof(mallocArea_ *). since mallocArea_ and
mallocArea_* are the same size, this error is not fatal. (i just printed
them out on linux/i686/gnu and they are both = 4)
the code snippet in question, which i think is:
+ temp = (mallocArea_ *) ptr;
+ *temp = a;
+ ptr = ptr + sizeof(mallocArea_*);
could be better expressed like this:
*(mallocArea_ *)ptr = a;
ptr = ptr + sizeof(mallocArea_*)
*ptr then points to the mallocArea a, after which ptr must be incremented to
point to the remaining allocated memory.
below is a diff with just those two changes, which has been tested on
i686/gnu/linux.
[bdavis@localhost f]$ cvs diff malloc.c
Index: malloc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/f/Attic/malloc.c,v
retrieving revision 1.12.14.1
diff -r1.12.14.1 malloc.c
308c308
< t = (mallocArea_ *) (ptr - sizeof(mallocArea_));
---
> t = (mallocArea_ *) (ptr - sizeof(mallocArea_ *));
380d379
< mallocArea_ *temp;
395,396c394
< temp = (mallocArea_ *) ptr;
< *temp = a;
---
> *(mallocArea_ *)ptr = a;
with the above correction(s), i think it is OK.
if you have any other problems, or need me to re-work this
in any way, i will work it with the highest priority. i understand
this is holding up gcc-3.4.2
--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.
Reply to: