Skip to content

Exception on multiplication with long numbers in "-arithMode" is not "math" #61

@woosh

Description

@woosh

Problem

When the program

void main() {
    long val = (((long) 1) * ((long) 1));
    assert(val == 1);
}

is run with command line

tri -arithMode:ilp32 example.c

it gives

(error "-1 is out of bounds (min 0, max 1)")
Other Error: -1 is out of bounds (min 0, max 1)

The expected result is SAFE. Using arithMode:lp64 or arithMode:llp64 gives the same result.

Note

Both

void main() {
    long val = (((long) 1) * (1L));
    assert(val == 1);
}

and

void main() {
    long val = ((1L) * (1L));
    assert(val == 1);
}

work fine. This may suggest that something is off when doing type casts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions