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

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

[avr-libc-dev] [Bug #2481] atoi.S and atol.S: incorrect handling of post


From: nobody
Subject: [avr-libc-dev] [Bug #2481] atoi.S and atol.S: incorrect handling of post characters if not \0
Date: Wed, 05 Feb 2003 09:40:55 -0500

=================== BUG #2481: FULL BUG SNAPSHOT ===================
http://savannah.nongnu.org/bugs/?func=detailbug&bug_id=2481&group_id=2140

Submitted by: zenker                  Project: AVR C Runtime Library        
Submitted on: 2003-Feb-05 15:40
Category:  None                       Severity:  5 - Major                  
Bug Group:  None                      Resolution:  None                     
Assigned to:  None                    Originator Email:  address@hidden       
Status:  Open                         

Summary:  atoi.S and atol.S: incorrect handling of post characters if not \0

Original Submission:  According to the description in the header the conversion 
should stop at detection of an non numeric character. But if the non numeric 
character is different from \0 then 
the minus sign is placed by mistake.

.
.
.
.atol_sig:
        CP      num_lo_lo, __zero_reg__
        CPC     num_lo_hi, __zero_reg__
        CPC     num_hi_lo, __zero_reg__
        CPC     num_hi_hi, __zero_reg__ ; did we get a number?
        BREQ    .atol_done      ; no, drop sign and return
        CLR     tmp             ; MUST be set to 0 else
                                ; there would be a      
                                ; misinterpretation if
                                ; the last Char isn't "\0"
        BLD             tmp, 0  ; get sign again
        TST             tmp     ; positive number?
        BREQ    .atol_done
.
.
.

In order to have a correct conversion the line
with the "CLR tmp" must be added. Or even better (by Christian Ludlam): Replace 
the
        BLD             tmp, 0  ; get sign again
        TST             tmp     ; positive number?
        BREQ    .atol_done
simply by
        BRTC .atol_done


Regards
Olaf




No Followups Have Been Posted


CC list is empty


No files currently attached


For detailed info, follow this link:
http://savannah.nongnu.org/bugs/?func=detailbug&bug_id=2481&group_id=2140




reply via email to

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