🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #42021

Query on malloc 2.6.3

#42021
From: Carlos da Roza
Date: Tue, 16 Jan 1996 00:00
24 lines
1663 bytes
Under gcc 2.6.3, I'm reaching a condition where I'm getting segment 
faults on a malloc (no switches on gcc).  Compiled under level 3 debug 
(gdb) and executed, at the point of the segmentation fault, the back 
trace shows a call into __gcc_malloc, which calls _malloc.  When I try a 
"print malloc(7)", it faults, as it does with any value less than, say 
9.  Thus "print malloc(7)" yields a segmentation fault, while a "print 
malloc(9)" works.  I figure I've corrupted heap somewhere, so I slowly 
step through the code from the beginning.

At one point in the code (before the segmentation fault), I do two 
mallocs, one after the other, with valid positive arguments.  The 
returns are queer...they are identical and seem to be large values (e.g. 
0x1ff78).

The question is: Is there a location I can go to look up debug problems 
like this?  By the way, it does compile and execute clean under MS 
Visual C, although I am aware that there are some differences...I 
believe I've avoided the issues of constant strings (can be overwritten 
in MSC, not in gcc), and a check for NULL returns on malloc.

Thanks,

Carlos da Roza
daroza@cn.ca
Technical Details
Message-ID: <30FB5842.40B9@cn.ca>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,46d01393105ecdf3,start
X-Google-Attributes: gid11318c,public
From: Carlos da Roza <daroza@cn.ca>
Subject: Query on malloc 2.6.3
Date: 1996/01/16
Message-ID: <30FB5842.40B9@cn.ca>
X-Deja-AN: 135387387
sender: usenet@goshawk.cn.ca (news)
cc: daroza@cn.ca
content-type: text/plain; charset=us-ascii
organization: Canadian National Railways
mime-version: 1.0
newsgroups: gnu.gcc.help
x-mailer: Mozilla 2.0b3 (Win95; I)