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]

RE: Live range splitting in new allocator



>Seriously, though, Robert does have a point; the perfect can be the enemy
>of the good.  And I've even used the technique back when I did embedded
>systems stuff, initializing "uninitialized memory" to 0xdeadbeef because
>it looked cool on the screen of our emulator:
>
>001000 DEAD BEEF DEAD BEEF ....

  This is particularly good on systems like Ppc that don't support unaligned
accesses because it's an odd number, and you're twice as likely to get an
exception the moment you try and use it for anything.  My favourites include
0xBADF00D, 0xDEADF00D, 0xBADC0DED and if I'm not too bothered about odd
numbers 0xF00DFACE and 0xBADCAFE; I'll use one to mung the lo memory and
fill in unused exception vectors, another to fill before and after malloc'ed
blocks, and in a lot of cases you can then spot the difference between a 
NULL ptr deref and an array overrun just by checking the pc when your code
excepts.

  <sigh>I guess that's the nearest to fun that coding ever gets to be...
 
        DaveK
-- 
The Boulder Pledge: "Under no circumstances will I ever purchase anything 
offered to me as the result of an unsolicited email message. Nor will I 
forward chain letters, petitions, mass mailings, or virus warnings to large 
numbers of others. This is my contribution to the survival of the online
community." 


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************

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