Allow -2147483648 (LONG_MIN) as valid input to strtol(), not setting errno.

This is what other implementations do and seems to be the intent of the standards, although the wording isn't entirely clear.
This commit is contained in:
Stephen Heumann 2020-01-24 12:25:01 -06:00
parent 14554fcdc7
commit 8490da9d85
1 changed files with 7 additions and 1 deletions

View File

@ -843,10 +843,16 @@ cn3 ph4 str save the starting string
sta val
txy see if we have an overflow
bpl rt1
ldy negative allow -2147483648 as legal value
beq ov0
cpx #$8000
bne ov0
tay
beq rt1
;
; Overflow - flag the error
;
lda #ERANGE errno = ERANGE
ov0 lda #ERANGE errno = ERANGE
sta >errno
ldx #$7FFF return value = LONG_MAX
ldy #$FFFF