PATCH: bug in gcc.c-torture/execute/960327-1.c: overwrites stack-frame.

Jeffrey A Law law@cygnus.com
Wed Apr 5 09:26:00 GMT 2000


  In message < 200004041548.RAA29553@ignucius.axis.se >you write:
  > The bug is that the sprintf "X" writing to s + 12 will
  > overwrite 'X' replacing the \0 that ends the string, but also
  > write a \0 at the location *after that* in the stack-frame.  For
  > many targets there's pad or nothing of importance there.  For
  > some targets this is the low byte of the return address.
  > Wheee... (imagine ejection seat activated indoors).
  > 
  > Although this change looks safe, I might be tampering with the original
  > purpose of the test.  Is there anyone around that remembers this test and
  > can comment?
  > 
  > Ok to install?
  > 
  > Tue Apr  4 17:10:57 2000  Hans-Peter Nilsson  <hp@axis.com>
  > 
  > 	* execute/960327-1.c (f): Add a letter to s[] to avoid stack-frame
  > 	overwrite.
Good catch.

I thought the test looked familiar -- it turns out to be one of mine.  I
went back and scanned my old mail archives and found the description of the
bug.

Basically combine was not initializing reg_nonzero_bits and reg_sign_bit_copies
for auto-incremented registers.

I reverted the fix to combine, then applied your change to 960327-1.c and
verified that the test fails.  So your change does not compromise the
test.

Please install your change to 960327-1.c

Thanks!
jeff



More information about the Gcc-patches mailing list