Skip to content

Incorrect parsing of INT64_MAX and INT64_MIN #1356

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
czgdp1807 opened this issue Dec 12, 2022 · 1 comment
Open

Incorrect parsing of INT64_MAX and INT64_MIN #1356

czgdp1807 opened this issue Dec 12, 2022 · 1 comment
Assignees
Labels
Parser Issues or improvements related to parser

Comments

@czgdp1807
Copy link
Collaborator

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.

@czgdp1807 czgdp1807 changed the title Incorrect parsing INT64_MAX and INT64_MIN Incorrect parsing of INT64_MAX and INT64_MIN Dec 12, 2022
@Thirumalai-Shaktivel Thirumalai-Shaktivel added the Parser Issues or improvements related to parser label Dec 12, 2022
@Thirumalai-Shaktivel
Copy link
Collaborator

Thirumalai-Shaktivel commented Dec 31, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Parser Issues or improvements related to parser
Projects
None yet
Development

No branches or pull requests

2 participants