[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Avr-gcc Produces Incorrect Code with -Os
From: |
Mark Litwack |
Subject: |
Re: [avr-gcc-list] Avr-gcc Produces Incorrect Code with -Os |
Date: |
Fri, 16 May 2008 11:05:25 -0400 |
User-agent: |
KMail/1.9.9 |
On Friday 16 May 2008 08:05:41 am Paulo Marques wrote:
> ....
>
> Note! This is not even the worst case for this optimization. The worst
> case I've seen is something like:
>
> int my_flag;
>
> ....
> cli();
> my_flag = 0x1234;
> sei();
> ....
>
> Contrary to what you might expect, that my_flag access isn't being
> protected by the cli/sei pair, and might be reordered by the compiler
> (and "might" here means "it has happened", not some theoretical scenario).
>
> Currently, the official way of doing something like that is using the
> macros provided in <util/atomic.h>.
Wow. I think the cli()/sei() construct is used fairly
universally, and it's also in the avr-libc docs.
What gives ATOMIC_BLOCK() it's special immunity? The memory
clobber?
-mark
- [avr-gcc-list] Avr-gcc Produces Incorrect Code with -Os, Thomas D. Dean, 2008/05/15
- Re: [avr-gcc-list] Avr-gcc Produces Incorrect Code with -Os, Dave N6NZ, 2008/05/15
- Re: [avr-gcc-list] Avr-gcc Produces Incorrect Code with -Os, Thomas D. Dean, 2008/05/15
- Re: [avr-gcc-list] Avr-gcc Produces Incorrect Code with -Os, David Brown, 2008/05/16
- RE: [avr-gcc-list] Avr-gcc Produces Incorrect Code with -Os, Loveny Design, 2008/05/16
- Re: [avr-gcc-list] Avr-gcc Produces Incorrect Code with -Os, Alex Wenger, 2008/05/16
- Re: [avr-gcc-list] Avr-gcc Produces Incorrect Code with -Os, Paulo Marques, 2008/05/16
- Re: [avr-gcc-list] Avr-gcc Produces Incorrect Code with -Os,
Mark Litwack <=
- RE: [avr-gcc-list] Avr-gcc Produces Incorrect Code with -Os, Weddington, Eric, 2008/05/16
- Re: [avr-gcc-list] Avr-gcc Produces Incorrect Code with -Os, Mark Litwack, 2008/05/16
- RE: [avr-gcc-list] Avr-gcc Produces Incorrect Code with -Os, Weddington, Eric, 2008/05/16
- Re: [avr-gcc-list] Avr-gcc Produces Incorrect Code with -Os, Paulo Marques, 2008/05/16
- RE: [avr-gcc-list] Avr-gcc Produces Incorrect Code with -Os, Weddington, Eric, 2008/05/16
- Re: [avr-gcc-list] Avr-gcc Produces Incorrect Code with -Os, John Regehr, 2008/05/16
- Re: [avr-gcc-list] Avr-gcc Produces Incorrect Code with -Os, Dave N6NZ, 2008/05/16
- Re: [avr-gcc-list] Avr-gcc Produces Incorrect Code with -Os, John Regehr, 2008/05/16
- RE: [avr-gcc-list] Avr-gcc Produces Incorrect Code with -Os, Weddington, Eric, 2008/05/16
- Re: [avr-gcc-list] Avr-gcc Produces Incorrect Code with -Os, Dave N6NZ, 2008/05/16