avr-libc-dev
[Top][All Lists]
Advanced

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

[avr-libc-dev] [bug #27434] Arguments of macros must be protected in par


From: Shaun Jackman
Subject: [avr-libc-dev] [bug #27434] Arguments of macros must be protected in parentheses
Date: Sun, 13 Sep 2009 18:58:39 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.10) Gecko/20071115 Firefox/2.0.0.10 (Debian-2.0.0.10-0etch1)

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/





reply via email to

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