This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

malloc - egcs-2.91.66 - generates segmentation fault


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





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]