public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: Alexander Basov <coopht@gmail.com>, gcc-patches@gcc.gnu.org
Subject: Re: Fix PR43404, PR48470, PR64744 ICE on naked functions
Date: Thu, 25 Jun 2015 18:52:00 -0000	[thread overview]
Message-ID: <558C4CDB.9030609@redhat.com> (raw)
In-Reply-To: <556F6079.7080209@gmail.com>

On 06/03/2015 02:15 PM, Alexander Basov wrote:
> Hello Jeff,
> please find updated patch attached
>
>>> diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
>>> index b190f91..c6db8a9 100644
>>> --- a/gcc/cfgexpand.c
>>> +++ b/gcc/cfgexpand.c
>>> @@ -1382,7 +1382,15 @@ expand_one_var (tree var, bool toplevel, bool
>>> really_expand)
>>>      else
>>>        {
>>>          if (really_expand)
>>> -        expand_one_stack_var (origvar);
>>> +        {
>>> +          if (!targetm.calls.allocate_stack_slots_for_args ())
>>> +            error ("cannot allocate stack for variable %q+D, naked
>>> function.",
>>> +                   var);
>>> +
>>> +          expand_one_stack_var (origvar);
>>> +        }
>> So how do you know ORIGVAR is an argument here before issuing the
>> error?  ie, shouldn't you verify that the underlying object is a
>> PARM_DECL? If there's some way we already know we're dealing with a
>> PARM_DECL, then just say so.
> In case of naked function stack should not be used not only for function
> args, but also for any local variables.
> So, i think we don't need to check if underlying object is a PARM_DECL.
Then that would indicate that we're using the wrong test 
(allocate_stack_slot_for_args).  That hook is for whether or not 
arguments should have stack slots allocated.  Yet you're issuing an 
error for more than just PARM_DECLs.

Shouldn't you instead be checking if the current function is a naked 
function or not by checking the attributes of the current function?

Jeff

  reply	other threads:[~2015-06-25 18:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-01 10:13 Alexander Basov
2015-06-02 21:22 ` Jeff Law
2015-06-03 20:17   ` Alexander Basov
2015-06-25 18:52     ` Jeff Law [this message]
2015-06-26  7:06       ` Alexander Basov
2015-06-29 13:41         ` Alexander Basov
2015-07-12 19:02           ` Alexander Basov
2015-08-03 19:35           ` Jeff Law
2015-07-24 22:24         ` Jeff Law

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=558C4CDB.9030609@redhat.com \
    --to=law@redhat.com \
    --cc=coopht@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    /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).