Re: GCC 15 -fzero-init-padding-bits= option and redzone clobber

Segher Boessenkool <[email protected]>
Newsgroups org.kernel.vger.linux-toolchains
Message-ID <[email protected]>
Hi!

On Fri, Nov 29, 2024 at 10:21:13AM -0800, Linus Torvalds wrote:
> On Fri, 29 Nov 2024 at 09:55, Linus Torvalds
> <[email protected]> wrote:
> >
> > This has happened with both gcc and clang, and telling the compiler
> > that we need the stack pointer fixes it. I don't actually remember who
> > told us to do that, but I think it was a gcc person.
> >
> > In fact, if I were a betting man, I would have thought it was you ;)
> 
> Ahh, found it. Not you. Segher. Doing some archeology finds this:
> 
>     https://gcc.gnu.org/legacy-ml/gcc/2015-07/msg00080.html
> 
> and even at the time, Segher suggested maybe having a separate "stack"
> clobber. But obviously that wasn't available at the time, and afaik
> has never happened.

But that would not mean changing the stack pointer, writing to something
on the stack instead.  Something like this "redzone" thing maybe.  I did
say it would have to have precise semantics specified :-)

> So we used that gcc suggestion, and it has worked fine for most of a
> decade by now.

Interesting.  And I was even accused of being "clever" in that thread,
wow!  :-)

But of course, GCC assumes there is a properly set up stack
*everywhere*, it can in principle insert calls *anywhere*.  So these
asm constraints are totally superfluous anyway!

(Input constraints do not say a reg is read, and output constraints do
not say it is written to.  Instead, they express the data flow,
something that is actually useful to the compiler, and very much
required as well).


Segher
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.