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

Failing test: felt252_to_bool_bug #290

Closed
igaray opened this issue Aug 11, 2023 · 2 comments · Fixed by #566
Closed

Failing test: felt252_to_bool_bug #290

igaray opened this issue Aug 11, 2023 · 2 comments · Fixed by #566
Labels
bug Something isn't working

Comments

@igaray
Copy link
Collaborator

igaray commented Aug 11, 2023

Failing program:

use array::ArrayTrait;

        fn felt_to_bool(x: felt252) -> bool {
            x == 1
        }

        fn run_test(a: felt252) -> bool {
            felt_to_bool(a)
        }

with input 1 when comparing to cairo-vm output

Test can be found in tests/boolean.rs felt252_to_bool_bug

comparing a felt252 == 1 will lead to wrong results

@igaray igaray added the bug Something isn't working label Aug 11, 2023
@igaray igaray added this to the ERC20 milestone Aug 11, 2023
@igaray igaray added this to Starknet Aug 11, 2023
@igaray igaray moved this to Todo in Starknet Aug 11, 2023
@azteca1998
Copy link
Collaborator

Running the code without --canonicalize works, therefore it's not a bug in our codebase, but rather in MLIR's. The canonicalization should always yield equivalent code, which is not the case in this bug.

I've opened an issue in the LLVM project: llvm/llvm-project#64774

@igaray igaray modified the milestones: ERC20, Merry Xmas Dec 12, 2023
@edg-l
Copy link
Collaborator

edg-l commented Dec 14, 2023

According to the linked pr this is fixed in a future llvm version already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants