This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
malloc - egcs-2.91.66 - generates segmentation fault
- To: gcc at gcc dot gnu dot org
- Subject: malloc - egcs-2.91.66 - generates segmentation fault
- From: David Svanberg <dasv901 at lollo dot lg dot posten dot se>
- Date: Thu, 21 Oct 1999 13:53:37 +0200
- Reply-To: david dot svanberg at kentor dot se
Hi.
I'm running egcs-2.91.66 on Linux kernel release 2.2.5 (i686). The
following code resides in a function:
file_entry *fe;
printf("trying to allocate %d bytes of mem...\n",
sizeof(file_entry));
fe = (file_entry *)malloc(sizeof(file_entry));
if (fe == NULL)
printf("can't allocate mem\n");
else
printf("memory allocated successfully!\n");
The second call to this function gives at the third line (output from
gdb):
Program received signal SIGSEGV, Segmentation fault.
0x40072609 in chunk_free (ar_ptr=0x40102580, p=0x919542a2) at
malloc.c:3003
The program is successfully compiled (no warnings) with -Wall -ansi
-pedantic. It has also been compiled and executed succesfully on a
HPUX-machine. (And yes, I got more than 12 bytes free mem)
Is there anyone who have heard of any bug in malloc.c (line 3003)? Are
there any fixes? Thankful for any answers.
Regards,
David Svanberg