URL:
<http://savannah.nongnu.org/bugs/?27434>
Summary: Arguments of macros must be protected in
parentheses
Project: AVR C Runtime Library
Submitted by: sjackman
Submitted on: Sun 13 Sep 2009 06:58:38 PM GMT
Category: Header
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Header files
Status: None
Percent Complete: 0%
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
Release: 1.6.7
Fixed Release: None
_______________________________________________________
Details:
I noticed this bug with boot_page_fill, but it applies to pretty much every
asm macro and macros in general. Macro arguments must be protected in
parentheses. These two lines
"z" ((uint16_t)address), \
"r" ((uint16_t)data) \
should be
"z" ((uint16_t)(address)), \
"r" ((uint16_t)(data)) \
otherwise the following code will break because the cast operation has higher
precedence than the shift operation:
uint32_t u32 = 123456789;
boot_page_fill(0, u32 >> 16);
Fortunately, gcc gives a warning in this case.
Cheers,
Shaun
_______________________________________________________
Reply to this item at:
<http://savannah.nongnu.org/bugs/?27434>
_______________________________________________
Message sent via/by Savannah
http://savannah.nongnu.org/
_______________________________________________
AVR-libc-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/avr-libc-dev