avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Re: optimizer removes volatile pin access code. why?


From: Joerg Wunsch
Subject: Re: [avr-gcc-list] Re: optimizer removes volatile pin access code. why?
Date: Mon, 2 Nov 2009 07:24:54 +0100 (MET)

David Brown <address@hidden> wrote:

> It might be worth filing a report for a better clarification in the
> documentation (does that need a bug report?) to make it clearer that
> "always_inline" has no effect without a normal "inline" declaration.

Ah yes, you are right.  Compile the following snippet:

#define PORTA (*(volatile uint8_t *)0x3B)

static inline void __attribute__((always_inline))
toggle_pin(void)
{
        PORTA |= 1;
        PORTA &= ~1;
}

int
main(void)
{
        toggle_pin();

        return 0;
}

with these two commands:

avr-gcc -O0 -S foo.c           # works correctly
avr-gcc -O0 -S -Dinline= foo.c # doesn't inline toggle_pin()

-- 
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]