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

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

Re: [avr-gcc-list] Avr-gcc Produces Incorrect Code with -Os


From: Paulo Marques
Subject: Re: [avr-gcc-list] Avr-gcc Produces Incorrect Code with -Os
Date: Fri, 16 May 2008 16:37:19 +0100
User-agent: Thunderbird 1.5.0.14 (X11/20071210)

Mark Litwack wrote:
On Friday 16 May 2008 08:05:41 am Paulo Marques wrote:
[...]
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?

Yes.

--
Paulo Marques
Software Development Department - Grupo PIE, S.A.
Phone: +351 252 290600, Fax: +351 252 290601
Web: www.grupopie.com

"To know recursion, you must first know recursion."




reply via email to

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