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

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

[avr-libc-dev] [bug #14503] strnlen_P is wrong with classic AVRs


From: anonymous
Subject: [avr-libc-dev] [bug #14503] strnlen_P is wrong with classic AVRs
Date: Sun, 11 Sep 2005 21:28:48 +0000
User-agent:

URL:
  <http://savannah.nongnu.org/bugs/?func=detailitem&item_id=14503>

                 Summary: strnlen_P is wrong with classic AVRs
                 Project: AVR C Runtime Library
            Submitted by: None
            Submitted on: Вск 11.09.2005 at 21:28
                Category: Library
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
        Percent Complete: 0%
        Originator Email: address@hidden
             Open/Closed: Open

    _______________________________________________________

Details:

strnlen_P is not work correctly for classic AVR-s. The reason
is next: macro 'LPM_R0_ZP' inserts 'adiw' instruction, which destroyed
a 'C' flag.
   Next program illustrates an error, if compiled for AT90S8515
chip:

   #include <avr/pgmspace.h>
   __attribute__((progmem)) char s[] = "12345";
   int main ()
   {
       return (strnlen_P(s,1) == 1) ? 0 : 1;
   }

It is possible to correct this error by moving LPM_R0_ZP before
the subi/sbci pair. Patch is present.

Dmitry.




    _______________________________________________________

Carbon-Copy List:

CC Address                          | Comment
------------------------------------+-----------------------------
dmixm --СБК-- marine --ТЧК-- febras --ТЧК-- ru | Originator Email



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Вск 11.09.2005 at 21:28  Name: strnlen_P.patch  Size: 325B   By:
None
Patch for 'strnlen_P.S' .
<http://savannah.nongnu.org/bugs/download.php?item_id=14503&item_file_id=2943>

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?func=detailitem&item_id=14503>

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





reply via email to

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