Skip to content

Integer overflow in power (^) doesn't throw an error or an exception #47215

Closed
@joelandman

Description

@joelandman
  1. versioninfo output
julia> versioninfo()
Julia Version 1.8.2
Commit 36034abf26 (2022-09-29 15:21 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 16 × AMD Ryzen 7 4800H with Radeon Graphics
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, znver2)
  Threads: 4 on 16 virtual cores
Environment:
  LD_LIBRARY_PATH = :/opt/rocm/hsa:/opt/rocm/hsa:/opt/rocm/llvm/lib:/opt/rocm/hip/lib:/opt/rocm/lib:/usr/local/cuda-11.7/lib64:/home/joe/local/lib:/home/joe/local/lib64
  JULIA_HOME = /home/joe/local
  1. how I installed Julia: Compiled from source

  2. minimum working example (a.k.a a reproducer)

julia> 10^18
1000000000000000000

julia> 10^19
-8446744073709551616

Julia should throw an error/exception when an integer overflow occurs. 10^18 is about 1/10th of the maxint for Int64 (2^63-1)

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