On 10/14/2015 02:28 AM, Eric Botcazou wrote:
If you're using one of the switches that checks for stack overflow at the
start of the function, you certainly don't want to do any such stores.

There is a protection area for -fstack-check (STACK_CHECK_PROTECT bytes) so
you can do stores just below the stack pointer as far as it's concerned.

There is indeed the issue of the mere writing below the stack pointer.  Our
experience with various OSes and architectures shows that this almost always
works.  The only problematic case is x86{-64}/Linux historically, where you
cannot write below the page pointed to by the stack pointer (that's why there
is a specific implementation of -fstack-check for x86{-64}/Linux).
It was problematical on the PA, but I can't recall precisely why.

The thing we need to remember here is that if we do somethig like use space just below the stack pointer, valgrind is probably going to start complaining (and legitimately so).

While we know the result is throw-away, valgrind doesn't and the complains and noise from this would IMHO outweigh the benefits from using the trick of reading outside the defined stack area.

jeff

Reply via email to