tags 698532 + upstream
# quality-of-implementation issue
severity 698532 wishlist
quit

Hi,

Osamu Aoki wrote:

> $ dash
> $ echo "$((18446744073709551616))"
> 9223372036854775807
[...]
> What dash returns for anything larger than 2^63-1=9223372036854775807
> are always quietly 2^63-1=9223372036854775807.  This is not signed long
> integer arithmetic.

The relevant code:

                yylval.val = strtoimax(buf, (char **)&arith_buf, 0);
                return ARITH_NUM;

POSIX saith:

        The arithmetic expression shall be processed according to the
        rules given in Section 1.1.2.1 (on page 2283), with the
        following exceptions:

In section 1.1.2.1 we see:

        Integer variables and constants, including the values of
        operands and option-arguments, used by the standard utilities
        listed in this volume of POSIX.1-2008 shall be implemented as
        equivalent to the ISO C standard signed long data type

In C99 we see:

        If an integer constant cannot be represented by any type in
        its list and has no extended integer type, then the integer
        constant has no type.

And:

        [When] the new type is signed and the value cannot be
        represented in it; either the result is implementation-defined
        or an implementation-defined signal is raised.

If I understand correctly, this behavior is implementation-defined.

Hope that helps,
Jonathan


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to