Skip to content

Negative values of signed ints treated as positive array indexes #2468

Closed
@msullivan

Description

@msullivan

Negative values of signed ints will be treated as positive for the purpose of indexing into arrays. This only comes up when using narrow int types. foo[-1i8] is equivalent to foo[255].

We think the solution is to sign extend array indexes in trans.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-codegenArea: Code generation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions