Skip to content
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

Incorrect cast behaviour in LiteralAnalyser #40

Open
lerno opened this issue Oct 27, 2018 · 2 comments
Open

Incorrect cast behaviour in LiteralAnalyser #40

lerno opened this issue Oct 27, 2018 · 2 comments
Labels

Comments

@lerno
Copy link
Collaborator

lerno commented Oct 27, 2018

  1. cast(3) => will cast the expression to a 31 bit integer.
  2. cast(2147483648) => 0
  3. cast(2147483647) => -1
  4. cast(1073741823) = 1073741823
  5. cast(1073741824) = -1073741824

The cast is using getIntegerWidth to set the resulting width, causing this issue.

@bvdberg
Copy link
Member

bvdberg commented Oct 30, 2018

Which syntax do you use exactly then? Because currently cast needs a generics-like argument, like:
cast<u32>(2147483648)

@lerno
Copy link
Collaborator Author

lerno commented Oct 30, 2018

It's in the implicit casts in the LiteralAnalyser when mixing uXX with iXX values.

@bvdberg bvdberg added the bug label Nov 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants