http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48470

--- Comment #3 from Stephen Cleary <gcc.ourteddybear at xoxy dot net> 
2011-07-26 15:56:40 UTC ---
(In reply to comment #2)
> The test case reduces to the following:
> void __attribute__((naked)) f(void)
> {
>     int x = 0;
>     g(&x);
> }
> It ICEs 4.4.5, 4.5.2, and 4.6.0, but not 4.3.5, 4.2.4, or 4.1.2.
> I suspect it isn't valid to make recursive calls or take the address of local
> variables in naked functions.

It is important to note, however, that the original test case does not take the
address of a local variable in a naked function. The original test case is like
this:

static void g(void);
void __attribute__((naked)) f(void)
{
    g();
}
void g(void)
{
    int x = 0;
    h(&x);
}

So this may be due to overzealous inlining.

Reply via email to