URL:
  <http://savannah.nongnu.org/bugs/?40003>

                 Summary: Integer type promotion leads to inefficent code in
wdt.h
                 Project: AVR C Runtime Library
            Submitted by: joeymorin
            Submitted on: Wed 11 Sep 2013 03:15:33 PM GMT
                Category: Library
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Header files
                  Status: None
        Percent Complete: 0%
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 1.8.0
           Fixed Release: None

    _______________________________________________________

Details:

Operands constructed in this fashion:
        "r" (_BV(_WD_CHANGE_BIT) | _BV(WDE)),

...result in the use of two registers, one of which is loaded with 0x00 and
never used.

Seems as though integer type promotion is responsible.  A fix is as simple as
casting to an 8-bit type:
        "r" ((uint8_t)(_BV(_WD_CHANGE_BIT) | _BV(WDE))),

Indeed, most __asm__ statements in wdt.h are already taking this approach, but
a couple are not.

Attached is a patch to resolve the issue.

I'm aware this is a minor issue, but as it is easy to resolve, I hope it will
be accepted :)

Cheers,
JJ





    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Wed 11 Sep 2013 03:15:33 PM GMT  Name: wdt.h.patch  Size: 802B   By:
joeymorin

<http://savannah.nongnu.org/bugs/download.php?file_id=29105>

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?40003>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


_______________________________________________
AVR-libc-dev mailing list
AVR-libc-dev@nongnu.org
https://lists.nongnu.org/mailman/listinfo/avr-libc-dev

Reply via email to