Skip to content

GCC/Clang O2 and O3 - Some shifts fail in release mode #23

@mratsim

Description

@mratsim
import ../src/mpint

let
  x: uint = 6905570704192331'u
  y: uint = 6821857284170478289'u
  z = x shl y

echo "x: " & $x
echo "y: " & $y
echo "z: " & $z

echo "\n"

let
  tx = cast[MpUint[64]](x)
  tz = cast[uint](x shl y)

echo "tz: " & $tz

I get the correct 1236503728129179648 in normal and 0 in release.

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