lpython
lpython copied to clipboard
Incorrect parsing of ``INT64_MAX`` and ``INT64_MIN``
Example
from ltypes import i64
negu: i64 = i64(-9223372036854775808)
posu: i64 = i64(9223372036854775808)
AST
(Module [(ImportFrom ltypes [(i64 ())] 0) (AnnAssign (Name negu Store) (Name i64 Load) (Call (Name i64 Load) [(UnaryOp USub (ConstantInt 4611686019631184192 ()))] []) 1) (AnnAssign (Name posu Store) (Name i64 Load) (Call (Name i64 Load) [(ConstantInt 4611686019631184322 ())] []) 1)] [])
9223372036854775808 and -9223372036854775808 are getting parsed to 4611686019631184192.
4611686019631184192 is the pointer to the very large number, which should have been handled later on (AST->ASR, ...).
This was followed in LFortran before. But, I don't know whether LFortran follows the same now.
I will look into this and report back.