You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
powerpc64 nightly: discriminant value 0isize already exists #39331
Probably yet another case of i128 fallout. I can’t even begin guessing where the problem is given that the compiler did just fine compiling stage0. May be trans? This for example?
I also see this with s390x, but the exact same configuration works fine on powerpc64le and x86_64, so that hints that this may be an endianness issue. I'm not sure how that would come up for enum discriminants though.
It also works fine on powerpc64 if I use the latest beta (rustc 1.15.0-beta.5 (10893a9a3 2017-01-19)) as the stage0 rustc, so it would seem to be a beta->nightly regression.
@cuviper Could you try compiling the compiler with the C_big_integral swapped out for code below and see if it works (ugh the pain of not having big endian CI :/):
pubfnC_big_integral(t:Type,u:u128,sign_extend:bool) -> ValueRef{if::std::mem::size_of::<u128>() == 16{unsafe{let words = [u asu64, u.wrapping_shr(64)asu64];
llvm::LLVMConstIntOfArbitraryPrecision(t.to_ref(),2, words.as_ptr())}}else{// SNAP: remove after snapshotC_integral(t, u asu64, sign_extend)}}
Also if you hop onto IRC, we could organise a “low” latency debugging session :)
On IRC, @nagisa suggested running this test command with the patch above:
python x.py test src/test/run-pass --stage=2 --test-args i128
Now, the patch doesn't directly help me when bootstrapping with the nightly stage0, because that cross-compiled rustc still has the bug. But I can run that test after bootstrapping with the beta stage0, where the build had looked like it succeeded, and indeed run-pass/i128.rs fails:
let z:i128 = 0xABCD_EF;assert_eq!(z * z,0x734C_C2F2_A521);
And that makes sense -- if z gets built with its 64-bit halves swapped, then the lower half will be 0 and squaring will overflow all the significant bits resulting in 0 overall. That right in hex also shows it has a reversed value, 0x734c_c2f2_a521_0000_0000_0000_0000.
With the patched C_big_integral, the same test now succeeds, huzzah!
(run-pass/i128-ffi.rs fails to link in both cases, because rust_test_helpers.c only defines the necessary functions for defined(__amd64__).)
Now, whether that fix will correct the issue with enum discriminants is harder to tell. The run-pass enum tests are passing for me after beta bootstrap with or without the patch. I think the cross-compiled aspect is probably important to the original problem, so I won't know until I can try with a new nightly stage0.
Activity
nagisa commentedon Jan 27, 2017
Probably yet another case of i128 fallout. I can’t even begin guessing where the problem is given that the compiler did just fine compiling stage0. May be trans? This for example?
cuviper commentedon Jan 27, 2017
I also see this with s390x, but the exact same configuration works fine on powerpc64le and x86_64, so that hints that this may be an endianness issue. I'm not sure how that would come up for enum discriminants though.
It also works fine on powerpc64 if I use the latest beta (
rustc 1.15.0-beta.5 (10893a9a3 2017-01-19)) as the stage0 rustc, so it would seem to be a beta->nightly regression.cuviper commentedon Jan 27, 2017
@nagisa So that's:
Calling:
That looks like a pretty good hunch, if LLVM is expecting little-endian
Words[].nagisa commentedon Jan 27, 2017
@cuviper Could you try compiling the compiler with the
C_big_integralswapped out for code below and see if it works (ugh the pain of not having big endian CI :/):Also if you hop onto IRC, we could organise a “low” latency debugging session :)
cuviper commentedon Jan 27, 2017
On IRC, @nagisa suggested running this test command with the patch above:
Now, the patch doesn't directly help me when bootstrapping with the nightly stage0, because that cross-compiled rustc still has the bug. But I can run that test after bootstrapping with the beta stage0, where the build had looked like it succeeded, and indeed
run-pass/i128.rsfails:on this part in particular:
And that makes sense -- if
zgets built with its 64-bit halves swapped, then the lower half will be 0 and squaring will overflow all the significant bits resulting in 0 overall. Thatrightin hex also shows it has a reversed value, 0x734c_c2f2_a521_0000_0000_0000_0000.With the patched
C_big_integral, the same test now succeeds, huzzah!(
run-pass/i128-ffi.rsfails to link in both cases, because rust_test_helpers.c only defines the necessary functions fordefined(__amd64__).)cuviper commentedon Jan 27, 2017
Now, whether that fix will correct the issue with enum discriminants is harder to tell. The run-pass enum tests are passing for me after beta bootstrap with or without the patch. I think the cross-compiled aspect is probably important to the original problem, so I won't know until I can try with a new nightly stage0.
cuviper commentedon Feb 2, 2017
Success! Using:
The native rebuild now completes successfully, and also passes the i128 tests. Thanks!