Mailing List ArchiveSupport open source code!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: tlug: gcc misplacing pointers?
- To: tlug@example.com, sstone@example.com
- Subject: Re: tlug: gcc misplacing pointers?
- From: "Andrew S. Howell" <andy@example.com>
- Date: Wed, 04 Mar 1998 15:02:43 +0900
- Content-Transfer-Encoding: 7bit
- Content-Type: Text/Plain; charset=us-ascii
- In-Reply-To: Your message of "Wed, 4 Mar 1998 13:32:38 +0900 (JST)"<Pine.LNX.3.96.980304133029.31202Z-100000@example.com>
- References: <Pine.LNX.3.96.980304133029.31202Z-100000@example.com>
- Reply-To: tlug@example.com
- Sender: owner-tlug@example.com
>>>>> "Scott" == Scott Stone <sstone@example.com> writes: Scott> char *s0; Scott> s0=(char *)malloc(80); Scott> (and then proceeded to do operations on s0). My first guess would be what the "operations on s0" are trampling over the bits of memory that malloc/free use to keep track of chunks of memory. As a second guess, the function is writing past the end of the 80 byte and killing something else. Scott> Anyway, it would segfault upon leaving the function in Scott> '_libc_free()', according to gdb. What was weird, though Scott> is that if I set the breakpoint one line past the malloc Scott> statement, and said 'print s0', it would say, 'no symbol s0 Scott> in current context'. I seen the behavior as well. Not sure of the cause. Scott> Changing s0 to be 'char s0[200]' and removing the malloc Scott> line fixed the problem. If it did not work the char s0[80], then the function is most likely writing past the end of the s0 and clobbering the stack. After thats done, anything can happen :) Scott> Any idea why gcc would 'lose' the pointer to s0 like that? Try 'info locals' in gdb. It will tell what it thinks your local variables are. One last possibility is that something before your function clobbered memory, making for some very strange behavior. On Solaris I use "purify" to catch such nasty things, but I don't know if there is a public domain equivalent. It checks all memory accesses to make sure nothing funny is going on. If there public domain tool that does the same, I love to find out about it. Andy --------------------------------------------------------------- Next TLUG Nomikai: 11 March Wed 1998 Tengu TokyoEkiMae 19:30 Chuo-ku, Kyobashi 1-1-6, EchiZenYa Bld. B1/B2 03-3275-3691 Next TLUG Meeting: 11 April 1998 Saturday, Tokyo Station Featuring Tague Griffith of Netscape i18n talking on source code --------------------------------------------------------------- a word from the sponsor: TWICS - Japan's First Public-Access Internet System www.twics.com info@example.com Tel:03-3351-5977 Fax:03-3353-6096
- Follow-Ups:
- Re: tlug: gcc misplacing pointers?
- From: Scott Stone <sstone@example.com>
- References:
- tlug: gcc misplacing pointers?
- From: Scott Stone <sstone@example.com>
Home | Main Index | Thread Index
- Prev by Date: tlug: gcc misplacing pointers?
- Next by Date: Re: tlug: Strange NFS behavior
- Prev by thread: tlug: gcc misplacing pointers?
- Next by thread: Re: tlug: gcc misplacing pointers?
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links