[bug #27434] Arguments of macros must be protected in parentheses

View: New views
3 Messages — Rating Filter:   Alert me  

[bug #27434] Arguments of macros must be protected in parentheses

by Phil Carmody-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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
AVR-libc-dev@...
http://lists.nongnu.org/mailman/listinfo/avr-libc-dev

[bug #27434] Arguments of macros must be protected in parentheses

by Phil Carmody-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Update of bug #27434 (project avr-libc):

                Severity:              3 - Normal => 4 - Important          
                Priority:              5 - Normal => 9 - Immediate          
                  Status:                    None => Fixed                  
        Percent Complete:                      0% => 100%                  
             Assigned to:                    None => arcanum                
             Open/Closed:                    Open => Closed                
           Fixed Release:                    None => 1.6.8                  

    _______________________________________________________

Follow-up Comment #1:

Thanks for the bug report!

Should be fixed now in CVS.

    _______________________________________________________

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
AVR-libc-dev@...
http://lists.nongnu.org/mailman/listinfo/avr-libc-dev

[bug #27434] Arguments of macros must be protected in parentheses

by Phil Carmody-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Follow-up Comment #2, bug #27434 (project avr-libc):

Thanks for the quick response!

    _______________________________________________________

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
AVR-libc-dev@...
http://lists.nongnu.org/mailman/listinfo/avr-libc-dev