-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Revert "Documentation: Remove warning that nonstandard primitive type sizes may reveal LLVM bugs" #58439
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
base: master
Are you sure you want to change the base?
Conversation
… sizes m…" This reverts commit 3fc2a15.
Per #58434 (comment), seems like this might not be an LLVM bug.
#58434 is about a multiple of 8 though, how does that issue show issues with non-multiples of 8? The bug is also unrelated to the exact size, since it's about padding when placed within a struct. |
From reading through the analysis done in #58434 and the PR in #58435, I don't think, that fully reverting #58262 is the correct thing to do. This is the summary I got from these discussions (with some interpretation from me included):
The fact that LLVM had bugs in the past in an area where we now also have/had a bug, does not seem to logically conclude that LLVM therefore must be buggy. We might consider adding a generic warning, that "using nonstandard primitive type sizes may reveal bugs" (note the absence of |
I guess this is a rhetorical question, but you made me curios: And indeed, when you deactivate the last part of this check with the fix on top of Julia master, this works correctly (repeatedly): julia> module Foo
primitive type UInt33 33 end
a = reinterpret(UInt33, ntuple(_ -> 0x0, 5))
res = (a,) === (a,)
f(x) = (x,) === (x,)
res2 = f(a)
g() = (a,) === (a,)
res3 = g()
function h()
x = reinterpret(UInt33, ntuple(_ -> 0x0, 5))
return (x,) === (x,)
end
res4 = h()
end; using .Foo; (Foo.res, Foo.res2, Foo.res3, Foo.res4)
(true, true, true, true) However, I am undecided on whether the But before we decided on how to construct these objects, all methods besides |
You can do
Nah, having non-multiple-of-8-bits primitive types is perfectly fine & valid. For example, zig has them:
Zig used to use/has used LLVM as a backend, making use of the same functionality Julia uses for primitive types. I think that's a good argument for that feature of LLVM being pretty stable & correct by now. |
Sorry, this was ambiguous. I was referring to the point that interpreting a 40 bits type as a 33 bits type look horribly wrong (which you confirmed). I agree, that non-multiple-of-8-bits primitive types are fine in general (when Julia supports them properly).
Thanks for this tip. However, it does not work in all cases: julia> Core.zext_int(UInt7, 0x0)
ERROR: ZExt: output bitsize must be > input bitsize |
Reverts #58262
See #58434, for an example bug.