Skip to content

signed division has undefined behaviour on overflow #8460

Closed
@thestinger

Description

@thestinger

Division by zero leads to undefined behavior. Overflow also leads to undefined behavior; this is a rare case, but can occur, for example, by doing a 32-bit division of -2147483648 by -1.

http://llvm.org/docs/LangRef.html#sdiv-instruction

Note that this is undefined behaviour, not just an unspecified result like a shift by too many bits. We need to add a check for this.

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