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

codegen assertion in BitIntegers #34288

Closed
JeffBezanson opened this issue Jan 6, 2020 · 6 comments · Fixed by #41178
Closed

codegen assertion in BitIntegers #34288

JeffBezanson opened this issue Jan 6, 2020 · 6 comments · Fixed by #41178
Assignees
Labels
bug Indicates an unexpected problem or unintended behavior compiler:codegen Generation of LLVM IR and native code

Comments

@JeffBezanson
Copy link
Member

With #34287 running ]test BitIntegers:

julia: /home/jeff/src/julia/src/cgutils.cpp:514: unsigned int convert_struct_offset(llvm::Type*, unsigned int): Assertion `SL->getElementOffset(idx) == byte_offset' failed.

signal (6): Aborted
in expression starting at /home/jeff/.julia/packages/BitIntegers/4QmBA/test/runtests.jl:333
gsignal at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
abort at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
unknown function (ip: 0x7f5b6a6b2bf5)
__assert_fail at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
convert_struct_offset at /home/jeff/src/julia/src/cgutils.cpp:514
convert_struct_offset at /home/jeff/src/julia/src/cgutils.cpp:527 [inlined]
convert_struct_offset at /home/jeff/src/julia/src/cgutils.cpp:520 [inlined]
emit_struct_gep at /home/jeff/src/julia/src/cgutils.cpp:525
emit_getfield_knownidx at /home/jeff/src/julia/src/cgutils.cpp:1672
emit_builtin_call at /home/jeff/src/julia/src/codegen.cpp:2872
@JeffBezanson JeffBezanson added the compiler:codegen Generation of LLVM IR and native code label Jan 6, 2020
@vtjnash
Copy link
Member

vtjnash commented Jan 6, 2020

Duplicate of #32414

@rfourquet
Copy link
Member

The fix for the duplicate doesn't seem to fix this issue, so re-opening. Sorry if I messed my testing and got this wrong.

@rfourquet rfourquet reopened this Mar 4, 2020
@rfourquet
Copy link
Member

rfourquet commented Mar 4, 2020

Minimal repro:

using BitIntegers
BitIntegers.@define_integers 24
Base.checked_usub_int(UInt24(3), UInt24(3)) == (UInt24(0), false)

@JeffBezanson JeffBezanson added the bug Indicates an unexpected problem or unintended behavior label Mar 4, 2020
rfourquet added a commit to rfourquet/BitIntegers.jl that referenced this issue May 15, 2020
rfourquet added a commit to rfourquet/BitIntegers.jl that referenced this issue May 15, 2020
@rfourquet
Copy link
Member

rfourquet commented May 12, 2021

The minimal repro above seems to have been fixed in 1.6. But I found another "Internal error" in today's master (d6c092d):

julia> using BitIntegers

julia> BitIntegers.@define_integers 24; x = UInt24(0);

julia> x
Internal error: encountered unexpected error in runtime:
MethodError(f=Main.UInt24, args=(0,), world=0x0000000000001133)
jl_method_error_bare at /local/src/julia/src/gf.c:1818
jl_method_error at /local/src/julia/src/gf.c:1836
jl_lookup_generic_ at /local/src/julia/src/gf.c:2406 [inlined]
jl_apply_generic at /local/src/julia/src/gf.c:2421
convert at ./number.jl:7
zero at ./number.jl:292
_jl_invoke at /local/src/julia/src/gf.c:2243 [inlined]
jl_apply_generic at /local/src/julia/src/gf.c:2425
[...]

It's a relatively recent error which was not there in d524f21 (81 days old master).
The error happens in show, defined as follows:

julia> print(stdout, "0x", string(x, pad = sizeof(x)<<1, base = 16))
0x000000
julia> f(x) = print(stdout, "0x", string(x, pad = sizeof(x)<<1, base = 16)); f(x)
Internal error: encountered unexpected error in runtime:
[...]
unknown function (ip: 0x401089)
0x000000

(note it still prints at the end).

@atbug
Copy link

atbug commented May 26, 2022

I am seeing the same error message in 1.7:

https://github.com/Hop-developers/Hop.jl/runs/6604926044

@KristofferC
Copy link
Member

Could you open a new issue about it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior compiler:codegen Generation of LLVM IR and native code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants