-
Notifications
You must be signed in to change notification settings - Fork 170
lpython_bit_length() fails for negative numbers in release mode #1836
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
Comments
Awesome, I wonder if it has something to do with compiling in optimized mode, which is what the Conda package uses. |
I would like to know if this issue is a general case or if it is something experienced specifically my environment setup. Dr. Ondrej, please, could you share if you are able to reproduce this? |
>>> (12).bit_length()
4
>>> u8(12).bit_length()
>>> i8(12).bit_length()
>>> x: i32 = i8(12).bit_length()
>>> x
0 Looking at the LLVM IR; Looks like no IR was generated: >>> (12).bit_length()
LLVM IR:
; ModuleID = 'LFortran'
source_filename = "LFortran"
define i32 @__main__global_stmts_1__() {
.entry:
%__main__global_stmts_1__1 = alloca i32, align 4
store i32 4, i32* %__main__global_stmts_1__1, align 4
br label %return
return: ; preds = %.entry
%0 = load i32, i32* %__main__global_stmts_1__1, align 4
ret i32 %0
}
Return type: i32
Result:
4
>>> (i8(12)).bit_length()
LLVM IR:
; ModuleID = 'LFortran'
source_filename = "LFortran"
Return type: none
Result:
(nothing to execute) And, no ASR is being generate
|
On latest main, compiling using the following commands on Mac M1
I am experiencing the following:
Originally posted by @Shaikh-Ubaid in #1835 (comment)
The text was updated successfully, but these errors were encountered: