public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "gjl at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/64052] compilation error "local frame unavailable" appears for some optimization levels
Date: Sat, 29 Nov 2014 20:27:00 -0000	[thread overview]
Message-ID: <bug-64052-4-DaMA2nyQwB@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-64052-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64052

Georg-Johann Lay <gjl at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gjl at gcc dot gnu.org

--- Comment #3 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
I think this PR is invalid:

Your code rets up avariable which needs a place to be stored, which is the
function frame for non-optimized code.  As the function is naked, no frame is
available to store the value.

If the compiler would not check this and proceed compilation, the resulting
code would be non-functional.  This is similar for C.  Consider

extern void fun (int*);

__attribute__((naked))
void test (void)
{
    int x;
    fun (&x);
}

There's no place to store x here, and this even applies to optimized code.

Apart from this, the documentation for "naked" attribute reads:

>> [...] It allows the compiler to construct the requisite function
>> declaration, while allowing the body of the function to be
>> assembly code.
>> [...] Only Basic asm statements can safely be included in naked
>> functions. While using Extended asm or a mixture of Basic asm
>> and C code may appear to work, they cannot be depended upon to
>> work reliably and are not supported.


  parent reply	other threads:[~2014-11-29 20:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-24 14:40 [Bug c++/64052] New: " eugene at hutorny dot in.ua
2014-11-24 16:14 ` [Bug target/64052] " rguenth at gcc dot gnu.org
2014-11-25 18:24 ` eugene at hutorny dot in.ua
2014-11-29 20:27 ` gjl at gcc dot gnu.org [this message]
2014-11-29 20:41 ` eugene at hutorny dot in.ua
2015-02-16 18:09 ` gjl at gcc dot gnu.org

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=bug-64052-4-DaMA2nyQwB@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).