public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Paul Brook <paul@codesourcery.com>
To: "Richard Guenther" <richard.guenther@gmail.com>
Cc: gcc-patches@gcc.gnu.org,
	 "Carlos O'Donell" <carlos@codesourcery.com>,
	 "Mark Mitchell" <mark@codesourcery.com>
Subject: Re: [PATCH] Stack corruption in naked functions.
Date: Fri, 23 May 2008 14:34:00 -0000	[thread overview]
Message-ID: <200805231448.33723.paul@codesourcery.com> (raw)
In-Reply-To: <84fc9c000805230626n30f55092qce936c3c32241966@mail.gmail.com>

On Friday 23 May 2008, Richard Guenther wrote:
> On Fri, May 23, 2008 at 3:23 PM, Paul Brook <paul@codesourcery.com> wrote:
> >> I wonder if you start to get ICEs all over the place if you use naked
> >> on a function with addressable local variables or with BLKmode
> >> parameters?  IMHO it would be better to sorry () as soon as a
> >> stack slot is allocated for such a function.
> >
> > I'd make it a proper error.  sorry() is for things that should work, but
> > we haven't got round to implementing.
> > In this case the documentation explicitly says this won't work. Any stack
> > slots are either user error or a compiler bug (like the one we're
> > fixing).
>
> But if it only doesn't work because at -O0 we're not optimizing then this
> case is a sorry () IMHO - of course we probably cannot easily distinguish
> our from the user errors here, so I won't mind using error either.

What are you referring to when you say "it doesn't work"?

The only supported use is that mentioned in the documentation. If that results 
in stack slots then this is an internal compiler error.  

If the stack slots result from code not permitted by the documentation then 
this is user error.  Some not-permitted code may happen to "work" at some 
optimisation levels with some compilers. However when this stops working 
(e.g. at -O0) it is IMHO not defect in the compiler, it is user error.  If 
anything the bug is that we allowed the code in the first place.

Paul

  reply	other threads:[~2008-05-23 13:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-23  2:28 Carlos O'Donell
2008-05-23 10:40 ` Richard Guenther
2008-05-23 13:27   ` Carlos O'Donell
2008-05-23 13:30     ` Richard Guenther
2008-05-23 13:31   ` Paul Brook
2008-05-23 13:48     ` Richard Guenther
2008-05-23 14:34       ` Paul Brook [this message]
2008-05-23 19:04         ` Mark Mitchell
2008-05-23 19:55           ` Richard Guenther
2008-05-23 20:23             ` Mark Mitchell
2008-05-23 20:28               ` Richard Guenther
2008-05-23 20:41                 ` Mark Mitchell
2008-05-23 20:59                   ` Carlos O'Donell
  -- strict thread matches above, loose matches on Subject: below --
2007-11-08 17:14 [patch] " Paul Brook
2007-11-12  3:27 ` Mark Mitchell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200805231448.33723.paul@codesourcery.com \
    --to=paul@codesourcery.com \
    --cc=carlos@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mark@codesourcery.com \
    --cc=richard.guenther@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).