Skip to content

Left-shift of 0 yields negative number #8864

@murilogiacometti

Description

@murilogiacometti

Compilation

ocamlopt -O3 -w -5-26 error.ml
ocamlc -w -5-26 error.ml

Program (error.ml)

let (i:int) = (lsl) (compare 0 0) 63 in print_int i

Output - Bytecode (ocamlc)

0

Output - Native (ocamlopt)

-4611686018427387904

Environment

environment       ocaml-base-compiler.4.08.0
ocamlc            4.08.0
ocamlopt          4.08.0
architecture/OS   x86_64 GNU/Linux

Issue found with https://github.com/jmid/efftester

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