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

mrustc 0.8.0 fails to build rust 1.19.0 on i686 #108

Open
daym opened this issue Jan 28, 2019 · 20 comments
Open

mrustc 0.8.0 fails to build rust 1.19.0 on i686 #108

daym opened this issue Jan 28, 2019 · 20 comments

Comments

@daym
Copy link
Contributor

daym commented Jan 28, 2019

Rust 1.19.0 fails to build via mrustc 0.8.0 on i686:

--8<---------------cut here---------------start------------->8---
$ "/gnu/store/fw4yy7cgb5ahs9s2ir00bawnsl5zj7db-mrustc-0.8.0/tools/bin/minicargo" "src/tools/cargo" "--vendor-dir" "src/vendor" "--output-dir" "output/cargo-build" "-L" "output/" "-L" "/gnu/store/fw4yy7cgb5ahs9s2ir00bawnsl5zj7db-mrustc-0.8.0/lib/mrust" "-j" "1"

BUILDING crates_io from crates-io v0.9.0 with features []
> /gnu/store/fw4yy7cgb5ahs9s2ir00bawnsl5zj7db-mrustc-0.8.0/bin/mrustc src/tools/cargo/src/crates-io/lib.rs --crate-name crates_io --crate-type rlib --crate-tag 0_9_0 -g --cfg debug_assertions -O -o output/cargo-build/libcrates_io-0_9_0.hir -L output/cargo-build --extern curl=output/cargo-build/libcurl-0_4_6.hir --extern error_chain=output/cargo-build/liberror_chain-0_10_0.hir --extern serde=output/cargo-build/libserde-1_0_6.hir --extern serde_derive=output/cargo-build/libserde_derive-1_0_6.hir --extern serde_json=output/cargo-build/libserde_json-1_0_2.hir --extern url=output/cargo-build/liburl-1_4_0.hir -L output -L /gnu/store/fw4yy7cgb5ahs9s2ir00bawnsl5zj7db-mrustc-0.8.0/lib/mrust  
munmap_chunk(): invalid pointer
src/tools/cargo/src/crates-io/lib.rs:65: BUG:src/expand/proc_macro.cpp:941: Unexpected EOF while reading from child process
--8<---------------cut here---------------end--------------->8---
@daym daym changed the title mrustc 0.8.0 fails to build rust 1.19.0 in suspicious way mrustc 0.8.0 fails to build rust 1.19.0 on i686 Jan 28, 2019
@daym
Copy link
Contributor Author

daym commented Jan 30, 2019

$ gdb --args /gnu/store/gpc2m2f79rsgy15m65x0s5av7a41rp8b-mrustc-0.8.0/bin/mrustc src/tools/cargo/src/crates-io/lib.rs --crate-name crates_io --crate-type rlib --crate-tag 0_9_0 -g --cfg debug_assertions -O -o output/cargo-build/libcrates_io-0_9_0.hir -L output/cargo-build --extern curl=output/cargo-build/libcurl-0_4_6.hir --extern error_chain=output/cargo-build/liberror_chain-0_10_0.hir --extern serde=output/cargo-build/libserde-1_0_6.hir --extern serde_derive=output/cargo-build/libserde_derive-1_0_6.hir --extern serde_json=output/cargo-build/libserde_json-1_0_2.hir --extern url=output/cargo-build/liburl-1_4_0.hir -L output -L /gnu/store/gpc2m2f79rsgy15m65x0s5av7a41rp8b-mrustc-0.8.0/lib/mrust
(gdb) set follow-fork-mode child
(gdb) r
Starting program: /gnu/store/gpc2m2f79rsgy15m65x0s5av7a41rp8b-mrustc-0.8.0/bin/mrustc src/tools/cargo/src/crates-io/lib.rs --crate-name crates_io --crate-type rlib --crate-tag 0_9_0 -g --cfg debug_assertions -O -o output/cargo-build/libcrates_io-0_9_0.hir -L output/cargo-build --extern curl=output/cargo-build/libcurl-0_4_6.hir --extern error_chain=output/cargo-build/liberror_chain-0_10_0.hir --extern serde=output/cargo-build/libserde-1_0_6.hir --extern serde_derive=output/cargo-build/libserde_derive-1_0_6.hir --extern serde_json=output/cargo-build/libserde_json-1_0_2.hir --extern url=output/cargo-build/liburl-1_4_0.hir -L output -L /gnu/store/gpc2m2f79rsgy15m65x0s5av7a41rp8b-mrustc-0.8.0/lib/mrust
Parse: V V V
(0.01 s) Parse: DONE
LoadCrates: V V V
(2.33 s) LoadCrates: DONE
Expand: V V V
[Attaching after process 7067 vfork to child process 7071]
[New inferior 2 (process 7071)]
[Detaching vfork parent process 7067 after child exec]
[Inferior 1 (process 7067) detached]
process 7071 is executing new program: /tmp/guix-build-rust-1.19.0.drv-6/rustc-1.19.0-src/output/cargo-build/libserde_derive-1_0_6.hir-plugin
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/gnu/store/qk8irm5yp2khq4dj7zcpcaa1g87pfyvw-glibc-2.28/lib/libthread_db.so.1".
munmap_chunk(): invalid pointer

Thread 2.1 "libserde_derive" received signal SIGABRT, Aborted.
[Switching to Thread 0xf7c9de80 (LWP 7071)]
0xf7fd4b59 in ?? ()
(gdb) bt
#0  0xf7fd4b59 in ?? ()
#1  0x00000000 in ?? ()

@daym
Copy link
Contributor Author

daym commented Feb 3, 2019

#109 may be related, but just fixing it didn't fix the crash.

@daym
Copy link
Contributor Author

daym commented Feb 5, 2019

We've reduced the crash to the following smaller test case:

$ gdb --args guix-build-rust-1.19.0.drv-0/rustc-1.19.0-src/output/cargo-build/libserde_derive-1_0_6.hir-plugin 'derive#Deserialize'
(gdb) r < ~/i686
Starting program: /tmp/guix-build-rust-1.19.0.drv-0/rustc-1.19.0-src/output/cargo-build/libserde_derive-1_0_6.hir-plugin derive#Deserialize < ~/i686
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/gnu/store/h90vnqw0nwd0hhm1l5dgxsdrigddfmq4-glibc-2.28/lib/libthread_db.so.1".
munmap_chunk(): invalid pointer

Program received signal SIGABRT, Aborted.
0xf7fd4b59 in __kernel_vsyscall ()
#0  0xf7fd4b59 in __kernel_vsyscall ()
#1  0xf7defa60 in raise () from /gnu/store/qk8irm5yp2khq4dj7zcpcaa1g87pfyvw-glibc-2.28/lib/libc.so.6
#2  0xf7df0bd7 in abort () from /gnu/store/qk8irm5yp2khq4dj7zcpcaa1g87pfyvw-glibc-2.28/lib/libc.so.6
#3  0xf7e2ff56 in __libc_message () from /gnu/store/qk8irm5yp2khq4dj7zcpcaa1g87pfyvw-glibc-2.28/lib/libc.so.6
#4  0xf7e36bbd in malloc_printerr () from /gnu/store/qk8irm5yp2khq4dj7zcpcaa1g87pfyvw-glibc-2.28/lib/libc.so.6
#5  0xf7e3713b in munmap_chunk () from /gnu/store/qk8irm5yp2khq4dj7zcpcaa1g87pfyvw-glibc-2.28/lib/libc.so.6
#6  0x0804e63e in _ZRK$aL_ZN5alloc7raw_vec6RawVec$aLu8$aR_as__ZN4core3ops4Drop$aR4drop (arg0=0x815c300) at output/cargo-build/libserde_derive-1_0_6.hir-plugin.c:61640
#7  _ZRI$aL_ZN5alloc7raw_vec6RawVec$aLu8$aR$aR11$Hdrop_glue (rv=0x815c300) at output/cargo-build/libserde_derive-1_0_6.hir-plugin.c:175
#8  _ZRI$aL_ZN11collections3vec3Vec$aLu8$aR$aR11$Hdrop_glue (rv=0x815c300) at output/cargo-build/libserde_derive-1_0_6.hir-plugin.c:185
#9  _ZRI$aL_ZN11collections6string6String$aR11$Hdrop_glue (rv=0x815c300) at output/cargo-build/libserde_derive-1_0_6.hir-plugin.c:192
#10 _ZRI$aL_ZN12syn$$0_11_115ident5Ident$aR11$Hdrop_glue (rv=0x815c300) at output/cargo-build/libserde_derive-1_0_6.hir-plugin.c:199
#11 _ZRI$aL_ZN4core6option12Option$HSome$aL_ZN12syn$$0_11_115ident5Ident$aR$aR11$Hdrop_glue (rv=0x815c300) at output/cargo-build/libserde_derive-1_0_6.hir-plugin.c:2304
#12 _ZRI$aL_ZN4core6option6Option$aL_ZN12syn$$0_11_115ident5Ident$aR$aR11$Hdrop_glue (rv=0x815c300) at output/cargo-build/libserde_derive-1_0_6.hir-plugin.c:2313
#13 _ZRI$aL_ZN30serde_derive_internals$$0_15_03ast5Field$aR11$Hdrop_glue (rv=0x815c300) at output/cargo-build/libserde_derive-1_0_6.hir-plugin.c:2350
#14 _ZRK$aL_ZN11collections3vec3Vec$aL_ZN30serde_derive_internals$$0_15_03ast5Field$aR_as__ZN4core3ops4Drop$aR4drop (arg0=0xffffc47c, arg0@entry=0xffffc558) at output/cargo-build/libserde_derive-1_0_6.hir-plugin.c:64862
#15 _ZRI$aL_ZN11collections3vec3Vec$aL_ZN30serde_derive_internals$$0_15_03ast5Field$aR$aR11$Hdrop_glue (rv=rv@entry=0xffffc47c) at output/cargo-build/libserde_derive-1_0_6.hir-plugin.c:1843
#16 0x0804e758 in _ZRI$aL_ZN30serde_derive_internals$$0_15_03ast12Body$HStruct$aR11$Hdrop_glue (rv=0xffffc478) at output/cargo-build/libserde_derive-1_0_6.hir-plugin.c:1852
#17 _ZRI$aL_ZN30serde_derive_internals$$0_15_03ast4Body$aR11$Hdrop_glue (rv=0xffffc478) at output/cargo-build/libserde_derive-1_0_6.hir-plugin.c:1868
#18 _ZRI$aL_ZN30serde_derive_internals$$0_15_03ast9Container$aR11$Hdrop_glue (rv=rv@entry=0xffffc3a0) at output/cargo-build/libserde_derive-1_0_6.hir-plugin.c:1882
#19 0x08070393 in _ZN19serde_derive$$1_0_62de25expand_derive_deserialize (arg0=0xffffc57c) at output/cargo-build/libserde_derive-1_0_6.hir-plugin.c:34299
#20 0x080708a1 in _ZN19serde_derive$$1_0_618derive_deserialize (arg0=...) at output/cargo-build/libserde_derive-1_0_6.hir-plugin.c:35190
#21 0x080eeb83 in _ZN10proc_macro4main (arg0=...) at output/libproc_macro.hir.o.c:5239
#22 0x0804b114 in _ZN19serde_derive$$1_0_612proc_macro$H4main () at output/cargo-build/libserde_derive-1_0_6.hir-plugin.c:35286
#23 0x080eb1fb in __rust_maybe_catch_panic (arg0=0x80bcb20 <_ZN3std9panicking3$H37do_call$aLfn_0_$T0$C$T0$aR>, arg1=0xffffc7b4 "", arg2=0xffffc7ac, arg3=0xffffc7b0) at output/libpanic_abort.hir.o.c:142
#24 0x080d052a in _ZN3std9panicking3try$aL$T0$Cfn_0_$T0$aR (arg0=0x804b100 <_ZN19serde_derive$$1_0_612proc_macro$H4main>) at output/libstd.hir.o.c:63801
#25 0x080d44f3 in _ZN3std2rt10lang_start (arg0=0x804b100 <_ZN19serde_derive$$1_0_612proc_macro$H4main>, arg1=2, arg2=0xffffc904) at output/libstd.hir.o.c:64578
#26 0x08049bc0 in main (argc=2, argv=0xffffc904) at output/cargo-build/libserde_derive-1_0_6.hir-plugin.c:86165
(gdb) frame 6
#6  0x0804e63e in _ZRK$aL_ZN5alloc7raw_vec6RawVec$aLu8$aR_as__ZN4core3ops4Drop$aR4drop (arg0=0x815c300) at output/cargo-build/libserde_derive-1_0_6.hir-plugin.c:61640
61640           _ZN5alloc4heap17__rust_deallocate( var4, var0, 0x1ull );
(gdb) l 61640
61635   bb1:
61636           var0 = var0 * arg0->_1; // Local(0) = BinOp(Local(0) MUL Field(1, Deref(Argument(0))))
61637           var3 = arg0;    // Local(3) = Borrow(0, Shared, Deref(Argument(0)))
61638           var4 = (uint8_t *)var3->_0._0._0;       // Local(4) = Cast(Field(0, Field(0, Field(0, Deref(Local(3))))) as *mut u8)
61639           var4 = var4;    // Local(4) = Cast(Local(4) as *mut u8)
61640           _ZN5alloc4heap17__rust_deallocate( var4, var0, 0x1ull );
61641           // ^ Call( Local(2) = ::"alloc"::heap::__rust_deallocate( Local(4), Local(0), 1 usize, ), bb2, bb3)
61642   bb2:
61643           ;       // Local(2) = Tuple()
61644           rv = var2;      // Return = Use(Local(2))

I suspect that the child processes' input deserializer is broken.

Base64 encoded, the ~/i686 is:

AQZzdHJ1Y3QBBUNyYXRlAAF7AQNwdWIBBG5hbWUAAToBBlN0cmluZwABLAEDcHViAQtkZXNjcmlw
dGlvbgABOgEGT3B0aW9uAAE8AQZTdHJpbmcAASwAAT4AASwBA3B1YgELbWF4X3ZlcnNpb24AAToB
BlN0cmluZwABLAABfQAA

sha256 sum of ~/i686 is:

d58044fc02a4cf1d85ce29ba9cfc44cffc6ebc52cc3ac25496afdc68d5981268  i686

@daym
Copy link
Contributor Author

daym commented Feb 6, 2019

Same with current git master of mrustc, commit 7b6fa5c.

@thepowersgang
Copy link
Owner

Hmm... works for me, using gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516 on linux 4.9.0-8-686-pae
Compiling cargo ran sucessfully.

@daym
Copy link
Contributor Author

daym commented Feb 8, 2019

Could you post the generated C code (the output of mrustc) of the working libserde_derive?

The failing C code is attached to the post at http://lists.gnu.org/archive/html/guix-devel/2019-02/msg00055.html (Currently using gcc is 5.5.0 on Guix)

@thepowersgang
Copy link
Owner

Looking at the backtrace above, I can see two things.
First the crash is happening in a drop, triggered by serde_derive::expand_derive_deserialize

#18 _ZRI$aL_ZN30serde_derive_internals$$0_15_03ast9Container$aR11$Hdrop_glue (rv=rv@entry=0xffffc3a0) at output/cargo-build/libserde_derive-1_0_6.hir-plugin.c:1882
#19 0x08070393 in _ZN19serde_derive$$1_0_62de25expand_derive_deserialize (arg0=0xffffc57c) at output/cargo-build/libserde_derive-1_0_6.hir-plugin.c:34299

Second, that line number doesn't match the line numbers in my build of current master (7d728e4) Can you try again with that revision, potentially running with valgrind?

@daym
Copy link
Contributor Author

daym commented Feb 12, 2019

Oops, with mrustc master, the failure is different!

Then, it fails on

output/rustc-build/rustc -C "linker=/gnu/store/n2p1zs14y89lwkg9da68y12pc10c6sw9-gcc-5.5.0/bin/gcc" "-Z" "force-unstable-if-unmarked" "-L" "output/target-libs" "src/libcore/lib.rs" "-o" "output/target-libs/libcore.rlib"

with SIGABORT.

$ gdb --args output/rustc-build/rustc -C "linker=/gnu/store/n2p1zs14y89lwkg9da68y12pc10c6sw9-gcc-5.5.0/bin/gcc" "-Z" "force-unstable-if-unmarked" "-L" "output/target-libs" "src/libcore/lib.rs" "-o" "output/target-libs/libcore.rlib"
(gdb) r
(gdb) bt
#0  0x00007ffff5158b10 in raise ()
   from /gnu/store/h90vnqw0nwd0hhm1l5dgxsdrigddfmq4-glibc-2.28/lib/libc.so.6
#1  0x00007ffff5159ca1 in abort ()
   from /gnu/store/h90vnqw0nwd0hhm1l5dgxsdrigddfmq4-glibc-2.28/lib/libc.so.6
#2  0x0000000000d64495 in _ZRI$aL_ZN4core6option6Option$aL_ZN6syntax3ast6NodeId$aR$aR7is_some (arg0=<synthetic pointer>)
    at output/rustc-build/librustc.hir.o.c:1079956
#3  _ZRI$aL_ZN5rustc3hir3map3Map$aR13trait_is_auto (arg0=<optimized out>, 
    arg1=..., arg1@entry=...) at output/rustc-build/librustc.hir.o.c:12700
#4  0x000000000123d3bc in _ZN12rustc_typeck7collect9trait_def (arg0=..., 
    arg1=...) at output/rustc-build/librustc_typeck.hir.o.c:257810
#5  0x0000000000cd7b13 in _ZRK$aL_ZN5rustc13closure_I_589$aL_ZN5rustc2ty4maps7queries9trait_def$Cfn_1_$Rs_$Rs__ZN5rustc2ty9trait_def8TraitDef_$Rs__ZN5rustc2ty9trait_def8TraitDef$C$Rs__ZN5rustc2ty9trait_def8TraitDef$aR_as__ZN4core3ops2Fn$aL$T0$aR$aR4call (arg0=arg0@entry=0x7ffff50d5930, arg1=..., arg1@entry=...)
    at output/rustc-build/librustc.hir.o.c:2171756
#6  0x0000000000dc3e4e in _ZRI$aL_ZN5rustc2ty7context6TyCtxt$aR11cycle_check$aL_ZN5rustc13closure_I_589$aL_ZN5rustc2ty4maps7queries9trait_def$Cfn_1_$Rs_$Rs__ZN5rustc2ty9trait_def8TraitDef_$Rs__ZN5rustc2ty9trait_def8TraitDef$C$Rs__ZN5rustc2ty9trait_def8TraitDef$aR$C$Rs__ZN5rustc2ty9trait_def8TraitDef$aR (arg0=..., 
    arg1=..., arg2=..., arg3=...)
    at output/rustc-build/librustc.hir.o.c:1383089
#7  0x0000000000e07fc6 in _ZRI$aL_ZN5rustc2ty4maps7queries9trait_def$aR12try_get_with$aLfn_1_$Rs_$Rs__ZN5rustc2ty9trait_def8TraitDef_$Rs__ZN5rustc2ty9trait_def8TraitDef$C$Rs__ZN5rustc2ty9trait_def8TraitDef$aR (arg0=..., arg1=..., 
    arg2=..., 
    arg3=0xbb8750 <_ZRK$aL$Rs__ZN5rustc2ty9trait_def8TraitDef_as__ZN4core5clone5Clone$aR5clone>) at output/rustc-build/librustc.hir.o.c:1478664
#8  0x0000000000e08279 in _ZRI$aL_ZN5rustc2ty4maps7queries9trait_def$aR7try_get
    (arg0=..., arg1=..., arg2=...)
    at output/rustc-build/librustc.hir.o.c:1478116
#9  0x0000000000e934a4 in _ZRI$aL_ZN5rustc2ty4maps8TyCtxtAt$aR9trait_def (
    arg0=..., arg1=...) at output/rustc-build/librustc.hir.o.c:1439576
#10 0x0000000000e9431e in _ZRI$aL_ZN5rustc2ty7context6TyCtxt$aR9trait_def (
    arg0=..., arg1=..., arg1@entry=...)
    at output/rustc-build/librustc.hir.o.c:1418194
#11 0x00000000012c19d3 in _ZRI$aL$pL_ZN12rustc_typeck7astconv7AstConv$pR$aR31create_substs_for_ast_trait_ref (arg0=..., arg1=..., arg2=arg2@entry=..., 
    arg3=0x7fffe4f7a660, arg4=0x7fffe55a15f0)
    at output/rustc-build/librustc_typeck.hir.o.c:569580
#12 0x00000000012c1d50 in _ZRI$aL$pL_ZN12rustc_typeck7astconv7AstConv$pR$aR26ast_path_to_mono_trait_ref (arg0=..., arg1=..., arg2=..., arg3=0x7fffe4f7a660, 
    arg4=0x7fffe55a15f0) at output/rustc-build/librustc_typeck.hir.o.c:565424
#13 0x00000000012c1eaa in _ZRI$aL$pL_ZN12rustc_typeck7astconv7AstConv$pR$aR26instantiate_mono_trait_ref (arg0=..., arg1=arg1@entry=0x7fffe55a0420, 
    arg2=0x7fffe4f7a660) at output/rustc-build/librustc_typeck.hir.o.c:571141
#14 0x000000000134013e in _ZRK$aL_ZN12rustc_typeck7collect9closure_5_as__ZN4core3ops2Fn$aL$T1_$Rs__ZN5rustc3hir8TraitRef$aR$aR4call (
    arg0=arg0@entry=0x7ffff50d6120, arg1=arg1@entry=...)
    at output/rustc-build/librustc_typeck.hir.o.c:775800
#15 0x0000000001340244 in _ZRI$aL_ZN4core6option6Option$aL$Rs__ZN5rustc3hir8TraitRef$aR$aR3map$aL_ZN5rustc2ty3sty8TraitRef$C_ZN12rustc_typeck7collect9closure_5$aR (arg1=..., arg0=...) at output/rustc-build/librustc_typeck.hir.o.c:350242
#16 _ZN12rustc_typeck7collect14impl_trait_ref (arg0=..., arg1=...)
    at output/rustc-build/librustc_typeck.hir.o.c:58955
#17 0x0000000000cd7e61 in _ZRK$aL_ZN5rustc13closure_I_611$aL_ZN5rustc2ty4maps7queries14impl_trait_ref$Cfn_1_$Rs__ZN4core6option6Option$aL_ZN5rustc2ty3sty8TraitRef$aR__ZN4core6option6Option$aL_ZN5rustc2ty3sty8TraitRef$aR$C_ZN4core6option6Option$aL_ZN5rustc2ty3sty8TraitRef$aR$aR_as__ZN4core3ops2Fn$aL$T0$aR$aR4call (
    arg0=arg0@entry=0x7ffff50d6330, arg1=..., arg1@entry=...)
    at output/rustc-build/librustc.hir.o.c:2173857
#18 0x0000000000dc425a in _ZRI$aL_ZN5rustc2ty7context6TyCtxt$aR11cycle_check$aL_ZN5rustc13closure_I_611$aL_ZN5rustc2ty4maps7queries14impl_trait_ref$Cfn_1_$Rs__ZN4core6option6Option$aL_ZN5rustc2ty3sty8TraitRef$aR__ZN4core6option6Option$aL_ZN5rustc2ty3sty8TraitRef$aR$C_ZN4core6option6Option$aL_ZN5rustc2ty3sty8TraitRef$aR$aR$C_ZN4core6option6Option$aL_ZN5rustc2ty3sty8TraitRef$aR$aR (arg0=..., 
    arg1=..., arg2=..., arg3=...)
    at output/rustc-build/librustc.hir.o.c:1386725
#19 0x0000000000dff387 in _ZRI$aL_ZN5rustc2ty4maps7queries14impl_trait_ref$aR12try_get_with$aLfn_1_$Rs__ZN4core6option6Option$aL_ZN5rustc2ty3sty8TraitRef$aR__ZN4core6option6Option$aL_ZN5rustc2ty3sty8TraitRef$aR$C_ZN4core6option6Option$aL_ZN5rustc2ty3sty8TraitRef$aR$aR (arg0=..., arg1=..., arg2=..., 
    arg3=0xbbdcf0 <_ZRK$aL_ZN4core6option6Option$aL_ZN5rustc2ty3sty8TraitRef$aR_as__ZN4core5clone5Clone$aR5clone>)
    at output/rustc-build/librustc.hir.o.c:1457747
#20 0x0000000000dff669 in _ZRI$aL_ZN5rustc2ty4maps7queries14impl_trait_ref$aR7try_get (arg0=..., arg1=..., arg2=...)
    at output/rustc-build/librustc.hir.o.c:1457199
#21 0x0000000000e57fb8 in _ZRI$aL_ZN5rustc2ty4maps8TyCtxtAt$aR14impl_trait_ref
    (arg0=..., arg1=...) at output/rustc-build/librustc.hir.o.c:1438976
#22 0x0000000000e58337 in _ZRI$aL_ZN5rustc2ty7context6TyCtxt$aR14impl_trait_ref
    (arg0=..., arg1=..., arg1@entry=...)
    at output/rustc-build/librustc.hir.o.c:1406192
#23 0x000000000125dd5b in _ZN12rustc_typeck7collect12convert_item (arg0=..., 
    arg1=...) at output/rustc-build/librustc_typeck.hir.o.c:254130
#24 0x000000000133a62f in _ZRK$aL_ZN12rustc_typeck7collect23CollectItemTypesVisitor_as__ZN5rustc3hir10intravisit7Visitor$aR10visit_item (arg1=0x7fffe55a03b0, 
    arg0=0x7ffff50d6c00) at output/rustc-build/librustc_typeck.hir.o.c:772987
#25 _ZRI$aL_ZN5rustc3hir5Crate$aR20visit_all_item_likes$aL_ZN5rustc3hir13itemlikevisit11DeepVisitor$aL_ZN12rustc_typeck7collect23CollectItemTypesVisitor$aR$aR
    (arg0=0x7ffff50dd9c0, arg1=arg1@entry=0x7ffff50d6bf8)
    at output/rustc-build/librustc_typeck.hir.o.c:42026
#26 0x000000000133a86e in _ZN12rustc_typeck7collect18collect_item_types (
    arg0=...) at output/rustc-build/librustc_typeck.hir.o.c:252930
#27 0x000000000133ac34 in _ZN5rustc4util6common4time$aL$T0$C_ZN12rustc_typeck9closure_1$aR (arg0=arg0@entry=false, arg1=..., arg2=..., arg2@entry=...)
    at output/rustc-build/librustc_typeck.hir.o.c:228285
#28 0x000000000134c333 in _ZRI$aL_ZN5rustc7session7Session$aR12track_errors$aL_ZN12rustc_typeck9closure_2$C$T0$aR (arg1=..., arg0=0x7ffff50e1930)
    at output/rustc-build/librustc_typeck.hir.o.c:385520
#29 _ZN12rustc_typeck11check_crate (arg0=...)
    at output/rustc-build/librustc_typeck.hir.o.c:51749
#30 0x0000000000b21f4a in _ZRK$aL_ZN12rustc_driver6driver10closure_22$aL_ZN12rustc_driver6driver10closure_49$C_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$aR_as__ZN4core3ops6FnOnce$aL$T1__ZN5rustc2ty7context6TyCtxt$aR$aR9call_once (arg0=..., 
    arg1=...) at output/rustc-build/librustc_driver.hir.o.c:421100
#31 0x0000000000b288e4 in _ZRK$aL_ZN5rustc2ty7context3tls9closure_2$aL_ZN12rustc_driver6driver10closure_22$aL_ZN12rustc_driver6driver10closure_49$C_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$aR$C_ZN4core6result6Result$aL_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$Cusize$aR$aR_as__ZN4core3ops6FnOnce$aL$T1_$Rs__ZN4core4cell4Cell$aL_ZN4core6option6Option$aL$T2_$Ss__ZN5rustc2ty7context3tls21ThreadLocalGlobalCtxt_$Ss__ZN5rustc2ty7context3tls20ThreadLocalInterners$aR$aR$aR$aR9call_once (
    arg1=..., arg0=...) at output/rustc-build/librustc_driver.hir.o.c:401953
#32 _ZRI$aL_ZN3std6thread5local8LocalKey$aL_ZN4core4cell4Cell$aL_ZN4core6option6Option$aL$T2_$Ss__ZN5rustc2ty7context3tls21ThreadLocalGlobalCtxt_$Ss__ZN5rustc2ty7context3tls20ThreadLocalInterners$aR$aR$aR$aR4with$aL_ZN5rustc2ty7context3tls9closure_2$aL_ZN12rustc_driver6driver10closure_22$aL_ZN12rustc_driver6driver10closure_49$C_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$aR$C_ZN4core6result6Result$aL_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$Cusize$aR$aR$C_ZN4core6result6Result$aL_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$Cusize$aR$aR (arg0=<optimized out>, arg1=...)
    at output/rustc-build/librustc_driver.hir.o.c:44049
#33 _ZN5rustc2ty7context3tls5enter$aL_ZN12rustc_driver6driver10closure_22$aL_ZN12rustc_driver6driver10closure_49$C_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$aR$C_ZN4core6result6Result$aL_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$Cusize$aR$aR (arg2=..., 
    arg1=0x7ffff50db2e8, arg0=0x7ffff50db2e0)
    at output/rustc-build/librustc_driver.hir.o.c:30884
#34 _ZRK$aL_ZN5rustc2ty7context3tls9closure_1$aL_ZN12rustc_driver6driver10closure_22$aL_ZN12rustc_driver6driver10closure_49$C_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$aR$C_ZN4core6result6Result$aL_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$Cusize$aR$aR_as__ZN4core3ops6FnOnce$aL$T1_$Rs__ZN4core4cell4Cell$aLfn_2__ZN10syntax_pos4Span_$Ru__ZN4core3fmt9Formatter__ZN4core6result6Result$aL$T0$C_ZN4core3fmt5Error$aR$aR$aR$aR9call_once (arg1=..., arg0=...)
    at output/rustc-build/librustc_driver.hir.o.c:8546
#35 _ZRI$aL_ZN3std6thread5local8LocalKey$aL_ZN4core4cell4Cell$aLfn_2__ZN10syntax_pos4Span_$Ru__ZN4core3fmt9Formatter__ZN4core6result6Result$aL$T0$C_ZN4core3fmt5Error$aR$aR$aR$aR4with$aL_ZN5rustc2ty7context3tls9closure_1$aL_ZN12rustc_driver6driver10closure_22$aL_ZN12rustc_driver6driver10closure_49$C_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$aR$C_ZN4core6result6Result$aL_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$Cusize$aR$aR$C_ZN4core6result6Result$aL_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$Cusize$aR$aR (arg0=<optimized out>, arg1=...)
    at output/rustc-build/librustc_driver.hir.o.c:44300
#36 _ZRI$aL_ZN5rustc2ty7context6TyCtxt$aR16create_and_enter$aL_ZN12rustc_driver6driver10closure_22$aL_ZN12rustc_driver6driver10closure_49$C_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$aR$C_ZN4core6result6Result$aL_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$Cusize$aR$aR (arg12=..., arg11=..., arg10=..., arg9=..., arg8=..., arg7=..., 
    arg6=..., arg5=0x7ffff50d9d80, arg4=<optimized out>, arg3=..., arg2=..., 
    arg1=..., arg0=<optimized out>)
    at output/rustc-build/librustc_driver.hir.o.c:64562
#37 _ZN12rustc_driver6driver27phase_3_run_analysis_passes$aL_ZN12rustc_driver6driver10closure_49$C_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$aR (arg0=0x7ffff50e1930, 
    arg1=..., arg2=..., arg3=..., arg4=arg4@entry=0x7ffff50dce90, 
    arg5=arg5@entry=0x7ffff50ddaf0, arg6=..., arg7=...)
    at output/rustc-build/librustc_driver.hir.o.c:54402
#38 0x0000000000b2a9d3 in _ZN12rustc_driver6driver13compile_input (
    arg0=arg0@entry=0x7ffff50e1930, arg1=0x7ffff00014d0, 
    arg2=arg2@entry=0x7ffff50e0760, arg3=arg3@entry=0x7ffff50e05b0, 
    arg4=arg4@entry=0x7ffff50e05d0, arg5=..., arg6=arg6@entry=0x7ffff50e09f0)
    at output/rustc-build/librustc_driver.hir.o.c:182746
#39 0x0000000000b2ba5f in _ZN12rustc_driver12run_compiler (arg0=..., arg1=..., 
    arg2=..., arg3=...) at output/rustc-build/librustc_driver.hir.o.c:190568
#40 0x0000000000b2c015 in _ZRK$aL_ZN12rustc_driver9closure_0_as__ZN4core3ops2Fn$aL$T0$aR$aR4call (arg0=arg0@entry=0x7ffff50e7c8f, arg1=..., arg1@entry=...)
    at output/rustc-build/librustc_driver.hir.o.c:414972
#41 0x0000000000b2c087 in _ZRK$aL_ZN12rustc_driver10closure_24$aL_ZN12rustc_driver9closure_0$aR_as__ZN4core3ops6FnOnce$aL$T0$aR$aR9call_once (arg0=..., 
    arg1=..., arg1@entry=...)
    at output/rustc-build/librustc_driver.hir.o.c:416658
#42 0x0000000000b2c3a0 in _ZRK$aL_ZN12rustc_driver9closure_3$aL_ZN12rustc_driver10closure_24$aL_ZN12rustc_driver9closure_0$aR$aR_as__ZN4core3ops6FnOnce$aL$T0$aR$aR9call_once (arg0=..., arg1=..., arg1@entry=...)
    at output/rustc-build/librustc_driver.hir.o.c:416894
#43 0x0000000000b2c3ce in _ZN3std9panicking3$H37do_call$aL_ZN3std5panic16AssertUnwindSafe$aL_ZN12rustc_driver9closure_3$aL_ZN12rustc_driver10closure_24$aL_ZN12rustc_driver9closure_0$aR$aR$aR$C$T0$aR (
    arg0=arg0@entry=0x7ffff50eae40 "@\031t\001")
    at output/rustc-build/librustc_driver.hir.o.c:194543
#44 0x00000000006d169c in __rust_maybe_catch_panic (
    arg0=arg0@entry=0xb2c3c0 <_ZN3std9panicking3$H37do_call$aL_ZN3std5panic16AssertUnwindSafe$aL_ZN12rustc_driver9closure_3$aL_ZN12rustc_driver10closure_24$aL_ZN12rustc_driver9closure_0$aR$aR$aR$C$T0$aR>, 
    arg1=arg1@entry=0x7ffff50eae40 "@\031t\001", 
    arg2=arg2@entry=0x7ffff50eae30, arg3=arg3@entry=0x7ffff50eae38)
    at output/libpanic_abort.hir.o.c:108
#45 0x0000000000ac24d4 in _ZN3std9panicking3try$aL$T0$C_ZN3std5panic16AssertUnwindSafe$aL_ZN12rustc_driver9closure_3$aL_ZN12rustc_driver10closure_24$aL_ZN12rustc_driver9closure_0$aR$aR$aR$aR (arg0=...)
    at output/rustc-build/librustc_driver.hir.o.c:194665
#46 _ZRK$aL_ZN3std11closure_I_3$aL_ZN3std6thread7Builder$C_ZN12rustc_driver9closure_3$aL_ZN12rustc_driver10closure_24$aL_ZN12rustc_driver9closure_0$aR$aR$C$T0$aR_as__ZN4core3ops6FnOnce$aL$T0$aR$aR9call_once (arg0=..., arg1=...)
    at output/rustc-build/librustc_driver.hir.o.c:18406
--Type <RET> for more, q to quit, c to continue without paging--
#47 _ZRK$aL_ZN3std11closure_I_3$aL_ZN3std6thread7Builder$C_ZN12rustc_driver9closure_3$aL_ZN12rustc_driver10closure_24$aL_ZN12rustc_driver9closure_0$aR$aR$C$T0$aR_as__ZN5alloc5boxed5FnBox$aL$T0$aR$aR8call_box (arg0=..., arg1=...)
    at output/rustc-build/librustc_driver.hir.o.c:18341
#48 0x0000000000548aae in _ZN3std10sys_common6thread12start_thread (
    arg0=0x1741b00) at output/libstd.hir.o.c:79014
#49 0x0000000000548ad9 in _ZN3std3sys3imp6thread3$H012thread_start (
    arg0=<optimized out>) at output/libstd.hir.o.c:75462
#50 0x00007ffff7fa6019 in start_thread ()
   from /gnu/store/h90vnqw0nwd0hhm1l5dgxsdrigddfmq4-glibc-2.28/lib/libpthread.so.0
#51 0x00007ffff521692f in clone ()
   from /gnu/store/h90vnqw0nwd0hhm1l5dgxsdrigddfmq4-glibc-2.28/lib/libc.so.6

@thepowersgang
Copy link
Owner

see #78, iikely seeing the same failure

@daym
Copy link
Contributor Author

daym commented Feb 26, 2019

Could be. How can I debug it further?

@thepowersgang
Copy link
Owner

It looks like a panic from a bad enum tag, probably caused by memory corruption or bad structure alignment/sizes. Probably need to do some legwork to trace where the bad value is coming from.

@daym
Copy link
Contributor Author

daym commented Mar 12, 2019

I can do the legwork, but where do I start? Can I use valgrind memcheck on mrustc?

@thepowersgang
Copy link
Owner

on the output, sure.

@daym
Copy link
Contributor Author

daym commented Mar 12, 2019

Without valgrind, with current mrustc master (commit 3f44cec)'s compiled rust 1.19.0, I get SIGFPE on the const evaluator now :)

With valgrind, I get SIGABRT:

$ /gnu/store/s00li9knmnhly6whh08x2c6w3xqipvvs-profile/bin/valgrind --tool=memcheck "output/rustc-build/rustc" "-C" "linker=/gnu/store/mhkpjv29ssmr4cm71654x4c5gm40ncjb-gcc-5.5.0/bin/gcc" "-Z" "force-unstable-if-unmarked" "-L" "output/target-libs" "src/libcore/lib.rs" "-o" "output/target-libs/libcore.rlib"
[...]
==14141== Conditional jump or move depends on uninitialised value(s)
==14141==    at 0x86C1003: ??? (in /tmp/guix-build-rust-1.19.0.drv-0/rustc-1.19.0-src/output/rustc-build/rustc)
==14141== 
==14141== Conditional jump or move depends on uninitialised value(s)
==14141==    at 0x86FC7DB: ??? (in /tmp/guix-build-rust-1.19.0.drv-0/rustc-1.19.0-src/output/rustc-build/rustc)
==14141== 
==14141== Conditional jump or move depends on uninitialised value(s)
==14141==    at 0x86B739B: ??? (in /tmp/guix-build-rust-1.19.0.drv-0/rustc-1.19.0-src/output/rustc-build/rustc)
==14141== 
==14141== Conditional jump or move depends on uninitialised value(s)
==14141==    at 0x86B739B: ??? (in /tmp/guix-build-rust-1.19.0.drv-0/rustc-1.19.0-src/output/rustc-build/rustc)
==14141==    by 0xAC3D3EB: ???
==14141==    by 0xCF: ???
==14141==    by 0x1C4F4A6F: ???
==14141== 
==14141== Conditional jump or move depends on uninitialised value(s)
==14141==    at 0x86B739B: ??? (in /tmp/guix-build-rust-1.19.0.drv-0/rustc-1.19.0-src/output/rustc-build/rustc)
==14141==    by 0xAC3D3EB: ???
==14141==    by 0x162: ???
==14141==    by 0x1C4F891F: ???
==14141== 
==14141== Conditional jump or move depends on uninitialised value(s)
==14141==    at 0x86B739B: ??? (in /tmp/guix-build-rust-1.19.0.drv-0/rustc-1.19.0-src/output/rustc-build/rustc)
==14141==    by 0xAC3D3EB: ???
==14141==    by 0x216: ???
==14141==    by 0x1C5011DF: ???
==14141== 
==14141== Conditional jump or move depends on uninitialised value(s)
==14141==    at 0x86B739B: ??? (in /tmp/guix-build-rust-1.19.0.drv-0/rustc-1.19.0-src/output/rustc-build/rustc)
==14141==    by 0xAC3D3EB: ???
==14141==    by 0x2A9: ???
==14141==    by 0x1C5049FF: ???
[...]
error: comparison is useless due to type limits
  --> src/libcore/num/flt2dec/decoder.rs:97:6
   |
97 |     (sign < 0, decoded)
   |      ^^^^^^^^
   |
   = note: #[deny(unused_comparisons)] implied by #[deny(warnings)]
[...]
error: aborting due to previous error(s)
==14141== Process terminating with default action of signal 6 (SIGABRT)

Hmm, no debug symbols? I thought I saw a "-g" in the mrustc invocation? Hrrrm....

@daym
Copy link
Contributor Author

daym commented Mar 15, 2019

mrustc master-compiled rustc 1.19.0 as of mrustc commit 3f44cec doesn't work on x86_64 either, and fails with pretty similar error. In a way that's good because I have much better debugging tools for x86_64.

#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007ffff5159ca1 in __GI_abort () at abort.c:79
#2  0x0000000000d64495 in _ZRI$aL_ZN4core6option6Option$aL_ZN6syntax3ast6NodeId$aR$aR7is_some (arg0=<synthetic pointer>) at output/rustc-build/librustc.hir.o.c:1079956
#3  _ZRI$aL_ZN5rustc3hir3map3Map$aR13trait_is_auto (arg0=<optimized out>, arg1=..., arg1@entry=...) at output/rustc-build/librustc.hir.o.c:12700
#4  0x000000000123d3bc in _ZN12rustc_typeck7collect9trait_def (arg0=..., arg1=...) at output/rustc-build/librustc_typeck.hir.o.c:257810
#5  0x0000000000cd7b13 in _ZRK$aL_ZN5rustc13closure_I_589$aL_ZN5rustc2ty4maps7queries9trait_def$Cfn_1_$Rs_$Rs__ZN5rustc2ty9trait_def8TraitDef_$Rs__ZN5rustc2ty9trait_def8TraitDef$C$Rs__ZN5rustc2ty9trait_def8TraitDef$aR_as__ZN4core3ops2Fn$aL$T0$aR$aR4call (arg0=arg0@entry=0x7ffff50d5930, arg1=..., arg1@entry=...) at output/rustc-build/librustc.hir.o.c:2171756
#6  0x0000000000dc3e4e in _ZRI$aL_ZN5rustc2ty7context6TyCtxt$aR11cycle_check$aL_ZN5rustc13closure_I_589$aL_ZN5rustc2ty4maps7queries9trait_def$Cfn_1_$Rs_$Rs__ZN5rustc2ty9trait_def8TraitDef_$Rs__ZN5rustc2ty9trait_def8TraitDef$C$Rs__ZN5rustc2ty9trait_def8TraitDef$aR$C$Rs__ZN5rustc2ty9trait_def8TraitDef$aR (arg0=..., arg1=..., arg2=..., arg3=...) at output/rustc-build/librustc.hir.o.c:1383089
#7  0x0000000000e07fc6 in _ZRI$aL_ZN5rustc2ty4maps7queries9trait_def$aR12try_get_with$aLfn_1_$Rs_$Rs__ZN5rustc2ty9trait_def8TraitDef_$Rs__ZN5rustc2ty9trait_def8TraitDef$C$Rs__ZN5rustc2ty9trait_def8TraitDef$aR (arg0=..., arg1=..., arg2=..., arg3=0xbb8750 <_ZRK$aL$Rs__ZN5rustc2ty9trait_def8TraitDef_as__ZN4core5clone5Clone$aR5clone>) at output/rustc-build/librustc.hir.o.c:1478664
#8  0x0000000000e08279 in _ZRI$aL_ZN5rustc2ty4maps7queries9trait_def$aR7try_get (arg0=..., arg1=..., arg2=...) at output/rustc-build/librustc.hir.o.c:1478116
#9  0x0000000000e934a4 in _ZRI$aL_ZN5rustc2ty4maps8TyCtxtAt$aR9trait_def (arg0=..., arg1=...) at output/rustc-build/librustc.hir.o.c:1439576
#10 0x0000000000e9431e in _ZRI$aL_ZN5rustc2ty7context6TyCtxt$aR9trait_def (arg0=..., arg1=..., arg1@entry=...) at output/rustc-build/librustc.hir.o.c:1418194
#11 0x00000000012c19d3 in _ZRI$aL$pL_ZN12rustc_typeck7astconv7AstConv$pR$aR31create_substs_for_ast_trait_ref (arg0=..., arg1=..., arg2=arg2@entry=..., arg3=0x7fffe4f7a660, arg4=0x7fffe55a15f0) at output/rustc-build/librustc_typeck.hir.o.c:569580
#12 0x00000000012c1d50 in _ZRI$aL$pL_ZN12rustc_typeck7astconv7AstConv$pR$aR26ast_path_to_mono_trait_ref (arg0=..., arg1=..., arg2=..., arg3=0x7fffe4f7a660, arg4=0x7fffe55a15f0) at output/rustc-build/librustc_typeck.hir.o.c:565424
#13 0x00000000012c1eaa in _ZRI$aL$pL_ZN12rustc_typeck7astconv7AstConv$pR$aR26instantiate_mono_trait_ref (arg0=..., arg1=arg1@entry=0x7fffe55a0420, arg2=0x7fffe4f7a660) at output/rustc-build/librustc_typeck.hir.o.c:571141
#14 0x000000000134013e in _ZRK$aL_ZN12rustc_typeck7collect9closure_5_as__ZN4core3ops2Fn$aL$T1_$Rs__ZN5rustc3hir8TraitRef$aR$aR4call (arg0=arg0@entry=0x7ffff50d6120, arg1=arg1@entry=...) at output/rustc-build/librustc_typeck.hir.o.c:775800
#15 0x0000000001340244 in _ZRI$aL_ZN4core6option6Option$aL$Rs__ZN5rustc3hir8TraitRef$aR$aR3map$aL_ZN5rustc2ty3sty8TraitRef$C_ZN12rustc_typeck7collect9closure_5$aR (arg1=..., arg0=...) at output/rustc-build/librustc_typeck.hir.o.c:350242
[...]

@thepowersgang
Copy link
Owner

Works for me on x86_64 (gcc 6.3.0-18+deb9u1), might be some UB being triggered

@daym
Copy link
Contributor Author

daym commented May 4, 2019

FWIW We've been through some major gcc upgrades by now and the i686 failure with mrustc 0.8.0 is always the same. To reproduce, invoke make -f minicargo.mk output/cargo.

We are now at gcc 8.3.0--still the same failure happens.

Newest backtrace with the small reproducer is:

(gdb) r derive#Deserialize < ~/i686
Starting program: /home/dannym/src/mrustc/0.8.0/mrustc-0.8.0/output/cargo-build/libserde_derive-1_0_6.hir-plugin derive#Deserialize < ~/i686
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/gnu/store/qk8irm5yp2khq4dj7zcpcaa1g87pfyvw-glibc-2.28/lib/libthread_db.so.1".
munmap_chunk(): invalid pointer

Program received signal SIGABRT, Aborted.
0xf7fd4949 in __kernel_vsyscall ()
(gdb) bt
#0  0xf7fd4949 in __kernel_vsyscall ()
#1  0xf7e21a60 in raise () from /gnu/store/qk8irm5yp2khq4dj7zcpcaa1g87pfyvw-glibc-2.28/lib/libc.so.6
#2  0xf7e22bd7 in abort () from /gnu/store/qk8irm5yp2khq4dj7zcpcaa1g87pfyvw-glibc-2.28/lib/libc.so.6
#3  0xf7e61f56 in __libc_message () from /gnu/store/qk8irm5yp2khq4dj7zcpcaa1g87pfyvw-glibc-2.28/lib/libc.so.6
#4  0xf7e68bbd in malloc_printerr () from /gnu/store/qk8irm5yp2khq4dj7zcpcaa1g87pfyvw-glibc-2.28/lib/libc.so.6
#5  0xf7e6913b in munmap_chunk () from /gnu/store/qk8irm5yp2khq4dj7zcpcaa1g87pfyvw-glibc-2.28/lib/libc.so.6
#6  0x0804ef07 in _ZRK$aL_ZN5alloc7raw_vec6RawVec$aLu8$aR_as__ZN4core3ops4Drop$aR4drop (arg0=0x8158300, arg0=0x8158300) at output/cargo-build/libserde_derive-1_0_6.hir-plugin.c:61583
#7  _ZRI$aL_ZN5alloc7raw_vec6RawVec$aLu8$aR$aR11$Hdrop_glue (rv=0x8158300) at output/cargo-build/libserde_derive-1_0_6.hir-plugin.c:175
#8  _ZRI$aL_ZN11collections3vec3Vec$aLu8$aR$aR11$Hdrop_glue (rv=0x8158300) at output/cargo-build/libserde_derive-1_0_6.hir-plugin.c:185
#9  _ZRI$aL_ZN11collections6string6String$aR11$Hdrop_glue (rv=0x8158300) at output/cargo-build/libserde_derive-1_0_6.hir-plugin.c:192
#10 _ZRI$aL_ZN12syn$$0_11_115ident5Ident$aR11$Hdrop_glue (rv=0x8158300) at output/cargo-build/libserde_derive-1_0_6.hir-plugin.c:199
#11 _ZRI$aL_ZN4core6option12Option$HSome$aL_ZN12syn$$0_11_115ident5Ident$aR$aR11$Hdrop_glue (rv=0x8158300) at output/cargo-build/libserde_derive-1_0_6.hir-plugin.c:2304
#12 _ZRI$aL_ZN4core6option6Option$aL_ZN12syn$$0_11_115ident5Ident$aR$aR11$Hdrop_glue (rv=0x8158300) at output/cargo-build/libserde_derive-1_0_6.hir-plugin.c:2313
#13 _ZRI$aL_ZN30serde_derive_internals$$0_15_03ast5Field$aR11$Hdrop_glue (rv=0x8158300) at output/cargo-build/libserde_derive-1_0_6.hir-plugin.c:2350
#14 _ZRK$aL_ZN11collections3vec3Vec$aL_ZN30serde_derive_internals$$0_15_03ast5Field$aR_as__ZN4core3ops4Drop$aR4drop (arg0=0xffffd4ac, arg0@entry=0xffffd588) at output/cargo-build/libserde_derive-1_0_6.hir-plugin.c:64811
#15 _ZRI$aL_ZN11collections3vec3Vec$aL_ZN30serde_derive_internals$$0_15_03ast5Field$aR$aR11$Hdrop_glue (rv=rv@entry=0xffffd4ac) at output/cargo-build/libserde_derive-1_0_6.hir-plugin.c:1843
#16 0x0804f016 in _ZRI$aL_ZN30serde_derive_internals$$0_15_03ast12Body$HStruct$aR11$Hdrop_glue (rv=0xffffd4a8) at output/cargo-build/libserde_derive-1_0_6.hir-plugin.c:1868
#17 _ZRI$aL_ZN30serde_derive_internals$$0_15_03ast4Body$aR11$Hdrop_glue (rv=0xffffd4a8) at output/cargo-build/libserde_derive-1_0_6.hir-plugin.c:1868
#18 _ZRI$aL_ZN30serde_derive_internals$$0_15_03ast9Container$aR11$Hdrop_glue (rv=rv@entry=0xffffd3d0) at output/cargo-build/libserde_derive-1_0_6.hir-plugin.c:1882
#19 0x0806dfcb in _ZN19serde_derive$$1_0_62de25expand_derive_deserialize (arg0=0xffffd5ac) at output/cargo-build/libserde_derive-1_0_6.hir-plugin.c:34265
#20 0x0806e56b in _ZN19serde_derive$$1_0_618derive_deserialize (arg0=...) at output/cargo-build/libserde_derive-1_0_6.hir-plugin.c:61588
#21 0x080e9410 in _ZN10proc_macro4main (arg0=...) at output/libproc_macro.hir.o.c:5213
#22 0x0804a8e4 in _ZN19serde_derive$$1_0_612proc_macro$H4main () at output/cargo-build/libserde_derive-1_0_6.hir-plugin.c:35252
#23 0x0808919b in __rust_maybe_catch_panic (arg0=0x8099a90 <_ZN3std9panicking3$H37do_call$aLfn_0_$T0$C$T0$aR>, arg1=0xffffd7d4 "\320\250\004\b\001\330\377\377", arg2=0xffffd7cc, arg3=0xffffd7d0) at output/libpanic_abort.hir.o.c:142
#24 0x080ac36b in _ZN3std9panicking3try$aL$T0$Cfn_0_$T0$aR (arg0=0x804a8d0 <_ZN19serde_derive$$1_0_612proc_macro$H4main>) at output/libstd.hir.o.c:63752
#25 0x080b02a3 in _ZN3std2rt10lang_start (arg0=0x804a8d0 <_ZN19serde_derive$$1_0_612proc_macro$H4main>, arg1=2, arg2=0xffffd924) at output/libstd.hir.o.c:64534
#26 0x08049670 in main (argc=2, argv=0xffffd924) at output/cargo-build/libserde_derive-1_0_6.hir-plugin.c:86028

Hexdump (od -tx1) of the ~/i686 file that we are using to reproduce is (had been recorded from the mrustc invocation back then):

0000000 01 06 73 74 72 75 63 74 01 05 43 72 61 74 65 00
0000020 01 7b 01 03 70 75 62 01 04 6e 61 6d 65 00 01 3a
0000040 01 06 53 74 72 69 6e 67 00 01 2c 01 03 70 75 62
0000060 01 0b 64 65 73 63 72 69 70 74 69 6f 6e 00 01 3a
0000100 01 06 4f 70 74 69 6f 6e 00 01 3c 01 06 53 74 72
0000120 69 6e 67 00 01 2c 00 01 3e 00 01 2c 01 03 70 75
0000140 62 01 0b 6d 61 78 5f 76 65 72 73 69 6f 6e 00 01
0000160 3a 01 06 53 74 72 69 6e 67 00 01 2c 00 01 7d 00
0000200 00

Valgrind memcheck of the small reproducer is:

==8962== Command: output/cargo-build/libserde_derive-1_0_6.hir-plugin derive#Deserialize
==8962== 
==8962== Invalid write of size 4
==8962==    at 0x8092E8C: _ZRK$aL_ZN11collections3vec3Vec$aL_ZN30serde_derive_internals$$0_15_03ast5Field$aR_as__ZN11collections3vec10SpecExtend$aL_ZN30serde_derive_internals$$0_15_03ast5Field$C_ZN4core4iter3Map$aL_ZN4core4iter9Enumerate$aL_ZN4core5slice4Iter$aL_ZN12syn$$0_11_114data5Field$aR$aR$C_ZN30serde_derive_internals$$0_15_03ast9closure_1$aR$aR$aR11spec_extend.constprop.161 (libserde_derive_internals-0_15_0.hir.o.c:35055)
==8962==    by 0x8092FFC: _ZRK$aL_ZN11collections3vec3Vec$aL_ZN30serde_derive_internals$$0_15_03ast5Field$aR_as__ZN11collections3vec10SpecExtend$aL_ZN30serde_derive_internals$$0_15_03ast5Field$C_ZN4core4iter3Map$aL_ZN4core4iter9Enumerate$aL_ZN4core5slice4Iter$aL_ZN12syn$$0_11_114data5Field$aR$aR$C_ZN30serde_derive_internals$$0_15_03ast9closure_1$aR$aR$aR9from_iter (libserde_derive_internals-0_15_0.hir.o.c:34855)
==8962==    by 0x8092FFC: _ZN30serde_derive_internals$$0_15_03ast15fields_from_ast (libserde_derive_internals-0_15_0.hir.o.c:13347)
==8962==    by 0x8093092: _ZN30serde_derive_internals$$0_15_03ast15struct_from_ast (libserde_derive_internals-0_15_0.hir.o.c:13421)
==8962==    by 0x8097299: _ZRI$aL_ZN30serde_derive_internals$$0_15_03ast9Container$aR8from_ast (libserde_derive_internals-0_15_0.hir.o.c:25931)
==8962==    by 0x806D770: _ZN19serde_derive$$1_0_62de25expand_derive_deserialize (libserde_derive-1_0_6.hir-plugin.c:33748)
==8962==    by 0x806E56A: _ZN19serde_derive$$1_0_618derive_deserialize (libserde_derive-1_0_6.hir-plugin.c:35156)
==8962==    by 0x80E940F: _ZN10proc_macro4main (libproc_macro.hir.o.c:5213)
==8962==    by 0x804A8E3: _ZN19serde_derive$$1_0_612proc_macro$H4main (libserde_derive-1_0_6.hir-plugin.c:35252)
==8962==    by 0x808919A: __rust_maybe_catch_panic (libpanic_abort.hir.o.c:142)
==8962==    by 0x80AC36A: _ZN3std9panicking3try$aL$T0$Cfn_0_$T0$aR (libstd.hir.o.c:63752)
==8962==    by 0x80B02A2: _ZN3std2rt10lang_start (libstd.hir.o.c:64534)
==8962==    by 0x804966F: main (libserde_derive-1_0_6.hir-plugin.c:86028)
==8962==  Address 0x437a530 is 0 bytes after a block of size 328 alloc'd
==8962==    at 0x403462B: malloc (in /gnu/store/2abrjc69xvbqgs1lgvc8xab3nsd4sbg6-valgrind-3.15.0/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==8962==    by 0x80B46E8: _ZN12alloc_system3imp8allocate (liballoc_system.hir.o.c:357)
==8962==    by 0x8092FA4: _ZN5alloc4heap8allocate (libserde_derive_internals-0_15_0.hir.o.c:10997)
==8962==    by 0x8092FA4: _ZRI$aL_ZN5alloc7raw_vec6RawVec$aL_ZN30serde_derive_internals$$0_15_03ast5Field$aR$aR7reserve (libserde_derive_internals-0_15_0.hir.o.c:17164)
==8962==    by 0x8092FA4: _ZRI$aL_ZN5alloc7raw_vec6RawVec$aL_ZN30serde_derive_internals$$0_15_03ast5Field$aR$aR7reserve (libserde_derive_internals-0_15_0.hir.o.c:17113)
==8962==    by 0x8092FA4: _ZRK$aL_ZN11collections3vec3Vec$aL_ZN30serde_derive_internals$$0_15_03ast5Field$aR_as__ZN11collections3vec10SpecExtend$aL_ZN30serde_derive_internals$$0_15_03ast5Field$C_ZN4core4iter3Map$aL_ZN4core4iter9Enumerate$aL_ZN4core5slice4Iter$aL_ZN12syn$$0_11_114data5Field$aR$aR$C_ZN30serde_derive_internals$$0_15_03ast9closure_1$aR$aR$aR11spec_extend.constprop.161 (libserde_derive_internals-0_15_0.hir.o.c:35012)
==8962==    by 0x8092FFC: _ZRK$aL_ZN11collections3vec3Vec$aL_ZN30serde_derive_internals$$0_15_03ast5Field$aR_as__ZN11collections3vec10SpecExtend$aL_ZN30serde_derive_internals$$0_15_03ast5Field$C_ZN4core4iter3Map$aL_ZN4core4iter9Enumerate$aL_ZN4core5slice4Iter$aL_ZN12syn$$0_11_114data5Field$aR$aR$C_ZN30serde_derive_internals$$0_15_03ast9closure_1$aR$aR$aR9from_iter (libserde_derive_internals-0_15_0.hir.o.c:34855)
==8962==    by 0x8092FFC: _ZN30serde_derive_internals$$0_15_03ast15fields_from_ast (libserde_derive_internals-0_15_0.hir.o.c:13347)
==8962==    by 0x8093092: _ZN30serde_derive_internals$$0_15_03ast15struct_from_ast (libserde_derive_internals-0_15_0.hir.o.c:13421)
==8962==    by 0x8097299: _ZRI$aL_ZN30serde_derive_internals$$0_15_03ast9Container$aR8from_ast (libserde_derive_internals-0_15_0.hir.o.c:25931)
==8962==    by 0x806D770: _ZN19serde_derive$$1_0_62de25expand_derive_deserialize (libserde_derive-1_0_6.hir-plugin.c:33748)
==8962==    by 0x806E56A: _ZN19serde_derive$$1_0_618derive_deserialize (libserde_derive-1_0_6.hir-plugin.c:35156)
==8962==    by 0x80E940F: _ZN10proc_macro4main (libproc_macro.hir.o.c:5213)
==8962==    by 0x804A8E3: _ZN19serde_derive$$1_0_612proc_macro$H4main (libserde_derive-1_0_6.hir-plugin.c:35252)
==8962==    by 0x808919A: __rust_maybe_catch_panic (libpanic_abort.hir.o.c:142)
==8962==    by 0x80AC36A: _ZN3std9panicking3try$aL$T0$Cfn_0_$T0$aR (libstd.hir.o.c:63752)
==8962== 
==8962== Invalid read of size 1
==8962==    at 0x808DF8A: _ZRI$aL_ZN30serde_derive_internals$$0_15_04attr5Field$aR14rename_by_rule (libserde_derive_internals-0_15_0.hir.o.c:29838)
==8962==    by 0x8097312: _ZRI$aL_ZN30serde_derive_internals$$0_15_03ast9Container$aR8from_ast (libserde_derive_internals-0_15_0.hir.o.c:25995)
==8962==    by 0x806D770: _ZN19serde_derive$$1_0_62de25expand_derive_deserialize (libserde_derive-1_0_6.hir-plugin.c:33748)
==8962==    by 0x806E56A: _ZN19serde_derive$$1_0_618derive_deserialize (libserde_derive-1_0_6.hir-plugin.c:35156)
==8962==    by 0x80E940F: _ZN10proc_macro4main (libproc_macro.hir.o.c:5213)
==8962==    by 0x804A8E3: _ZN19serde_derive$$1_0_612proc_macro$H4main (libserde_derive-1_0_6.hir-plugin.c:35252)
==8962==    by 0x808919A: __rust_maybe_catch_panic (libpanic_abort.hir.o.c:142)
==8962==    by 0x80AC36A: _ZN3std9panicking3try$aL$T0$Cfn_0_$T0$aR (libstd.hir.o.c:63752)
==8962==    by 0x80B02A2: _ZN3std2rt10lang_start (libstd.hir.o.c:64534)
==8962==    by 0x804966F: main (libserde_derive-1_0_6.hir-plugin.c:86028)
==8962==  Address 0x437a554 is 12 bytes before a block of size 4 alloc'd
==8962==    at 0x403462B: malloc (in /gnu/store/2abrjc69xvbqgs1lgvc8xab3nsd4sbg6-valgrind-3.15.0/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==8962==    by 0x80B46E8: _ZN12alloc_system3imp8allocate (liballoc_system.hir.o.c:357)
==8962==    by 0x80980E7: _ZN5alloc4heap8allocate (libcollections.hir.o.c:8202)
==8962==    by 0x80980E7: _ZRI$aL_ZN5alloc7raw_vec6RawVec$aLu8$aR$aR8allocate (libcollections.hir.o.c:11226)
==8962==    by 0x809897E: _ZN11collections5slice4hack6to_vec$aLu8$aR (libcollections.hir.o.c:8716)
==8962==    by 0x8099338: _ZRK$aL_ZN11collections3vec3Vec$aLu8$aR_as__ZN4core5clone5Clone$aR5clone (libcollections.hir.o.c:28394)
==8962==    by 0x8099368: _ZRK$aL_ZN11collections6string6String_as__ZN11collections6string8ToString$aR9to_string (libcollections.hir.o.c:25632)
==8962==    by 0x80993A1: _ZRK$aL_ZN11collections6string6String_as__ZN4core5clone5Clone$aR5clone (in /home/dannym/src/mrustc/0.8.0/mrustc-0.8.0/output/cargo-build/libserde_derive-1_0_6.hir-plugin)
==8962==    by 0x80CACD8: _ZRK$aL_ZN12syn$$0_11_115ident5Ident_as__ZN4core5clone5Clone$aR5clone (libsyn-0_11_11.hir.o.c:85243)
==8962==    by 0x8092CA3: _ZRK$aL_ZN4core6option6Option$aL_ZN12syn$$0_11_115ident5Ident$aR_as__ZN4core5clone5Clone$aR5clone (libserde_derive_internals-0_15_0.hir.o.c:38745)
==8962==    by 0x8092CA3: _ZRK$aL_ZN30serde_derive_internals$$0_15_03ast9closure_1_as__ZN4core3ops2Fn$aL$T1_$T2_usize_$Rs__ZN12syn$$0_11_114data5Field$aR$aR4call (libserde_derive_internals-0_15_0.hir.o.c:40329)
==8962==    by 0x8092DF9: _ZRI$aL_ZN4core6option6Option$aL$T2_usize_$Rs__ZN12syn$$0_11_114data5Field$aR$aR3map$aL_ZN30serde_derive_internals$$0_15_03ast5Field$C$Ru__ZN30serde_derive_internals$$0_15_03ast9closure_1$aR (libserde_derive_internals-0_15_0.hir.o.c:24506)
==8962==    by 0x8092DF9: _ZRK$aL_ZN4core4iter3Map$aL_ZN4core4iter9Enumerate$aL_ZN4core5slice4Iter$aL_ZN12syn$$0_11_114data5Field$aR$aR$C_ZN30serde_derive_internals$$0_15_03ast9closure_1$aR_as__ZN4core4iter8iterator8Iterator$aR4next (libserde_derive_internals-0_15_0.hir.o.c:38335)
==8962==    by 0x8092DF9: _ZRK$aL_ZN11collections3vec3Vec$aL_ZN30serde_derive_internals$$0_15_03ast5Field$aR_as__ZN11collections3vec10SpecExtend$aL_ZN30serde_derive_internals$$0_15_03ast5Field$C_ZN4core4iter3Map$aL_ZN4core4iter9Enumerate$aL_ZN4core5slice4Iter$aL_ZN12syn$$0_11_114data5Field$aR$aR$C_ZN30serde_derive_internals$$0_15_03ast9closure_1$aR$aR$aR11spec_extend.constprop.161 (libserde_derive_internals-0_15_0.hir.o.c:35035)
==8962==    by 0x8092FFC: _ZRK$aL_ZN11collections3vec3Vec$aL_ZN30serde_derive_internals$$0_15_03ast5Field$aR_as__ZN11collections3vec10SpecExtend$aL_ZN30serde_derive_internals$$0_15_03ast5Field$C_ZN4core4iter3Map$aL_ZN4core4iter9Enumerate$aL_ZN4core5slice4Iter$aL_ZN12syn$$0_11_114data5Field$aR$aR$C_ZN30serde_derive_internals$$0_15_03ast9closure_1$aR$aR$aR9from_iter (libserde_derive_internals-0_15_0.hir.o.c:34855)
==8962==    by 0x8092FFC: _ZN30serde_derive_internals$$0_15_03ast15fields_from_ast (libserde_derive_internals-0_15_0.hir.o.c:13347)
==8962==    by 0x8093092: _ZN30serde_derive_internals$$0_15_03ast15struct_from_ast (libserde_derive_internals-0_15_0.hir.o.c:13421)
==8962== 
==8962== Invalid read of size 4
==8962==    at 0x808DFA0: _ZRK$aL_ZN11collections6string6String_as__ZN4core3ops5Deref$aR5deref (libserde_derive_internals-0_15_0.hir.o.c:34159)
==8962==    by 0x808DFA0: _ZRI$aL_ZN30serde_derive_internals$$0_15_04attr5Field$aR14rename_by_rule (libserde_derive_internals-0_15_0.hir.o.c:29843)
==8962==    by 0x8097312: _ZRI$aL_ZN30serde_derive_internals$$0_15_03ast9Container$aR8from_ast (libserde_derive_internals-0_15_0.hir.o.c:25995)
==8962==    by 0x806D770: _ZN19serde_derive$$1_0_62de25expand_derive_deserialize (libserde_derive-1_0_6.hir-plugin.c:33748)
==8962==    by 0x806E56A: _ZN19serde_derive$$1_0_618derive_deserialize (libserde_derive-1_0_6.hir-plugin.c:35156)
==8962==    by 0x80E940F: _ZN10proc_macro4main (libproc_macro.hir.o.c:5213)
==8962==    by 0x804A8E3: _ZN19serde_derive$$1_0_612proc_macro$H4main (libserde_derive-1_0_6.hir-plugin.c:35252)
==8962==    by 0x808919A: __rust_maybe_catch_panic (libpanic_abort.hir.o.c:142)
==8962==    by 0x80AC36A: _ZN3std9panicking3try$aL$T0$Cfn_0_$T0$aR (libstd.hir.o.c:63752)
==8962==    by 0x80B02A2: _ZN3std2rt10lang_start (libstd.hir.o.c:64534)
==8962==    by 0x804966F: main (libserde_derive-1_0_6.hir-plugin.c:86028)
==8962==  Address 0x437a53c is 12 bytes after a block of size 328 alloc'd
==8962==    at 0x403462B: malloc (in /gnu/store/2abrjc69xvbqgs1lgvc8xab3nsd4sbg6-valgrind-3.15.0/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==8962==    by 0x80B46E8: _ZN12alloc_system3imp8allocate (liballoc_system.hir.o.c:357)
==8962==    by 0x8092FA4: _ZN5alloc4heap8allocate (libserde_derive_internals-0_15_0.hir.o.c:10997)
==8962==    by 0x8092FA4: _ZRI$aL_ZN5alloc7raw_vec6RawVec$aL_ZN30serde_derive_internals$$0_15_03ast5Field$aR$aR7reserve (libserde_derive_internals-0_15_0.hir.o.c:17164)
==8962==    by 0x8092FA4: _ZRI$aL_ZN5alloc7raw_vec6RawVec$aL_ZN30serde_derive_internals$$0_15_03ast5Field$aR$aR7reserve (libserde_derive_internals-0_15_0.hir.o.c:17113)
==8962==    by 0x8092FA4: _ZRK$aL_ZN11collections3vec3Vec$aL_ZN30serde_derive_internals$$0_15_03ast5Field$aR_as__ZN11collections3vec10SpecExtend$aL_ZN30serde_derive_internals$$0_15_03ast5Field$C_ZN4core4iter3Map$aL_ZN4core4iter9Enumerate$aL_ZN4core5slice4Iter$aL_ZN12syn$$0_11_114data5Field$aR$aR$C_ZN30serde_derive_internals$$0_15_03ast9closure_1$aR$aR$aR11spec_extend.constprop.161 (libserde_derive_internals-0_15_0.hir.o.c:35012)
==8962==    by 0x8092FFC: _ZRK$aL_ZN11collections3vec3Vec$aL_ZN30serde_derive_internals$$0_15_03ast5Field$aR_as__ZN11collections3vec10SpecExtend$aL_ZN30serde_derive_internals$$0_15_03ast5Field$C_ZN4core4iter3Map$aL_ZN4core4iter9Enumerate$aL_ZN4core5slice4Iter$aL_ZN12syn$$0_11_114data5Field$aR$aR$C_ZN30serde_derive_internals$$0_15_03ast9closure_1$aR$aR$aR9from_iter (libserde_derive_internals-0_15_0.hir.o.c:34855)
==8962==    by 0x8092FFC: _ZN30serde_derive_internals$$0_15_03ast15fields_from_ast (libserde_derive_internals-0_15_0.hir.o.c:13347)
==8962==    by 0x8093092: _ZN30serde_derive_internals$$0_15_03ast15struct_from_ast (libserde_derive_internals-0_15_0.hir.o.c:13421)
==8962==    by 0x8097299: _ZRI$aL_ZN30serde_derive_internals$$0_15_03ast9Container$aR8from_ast (libserde_derive_internals-0_15_0.hir.o.c:25931)
==8962==    by 0x806D770: _ZN19serde_derive$$1_0_62de25expand_derive_deserialize (libserde_derive-1_0_6.hir-plugin.c:33748)
==8962==    by 0x806E56A: _ZN19serde_derive$$1_0_618derive_deserialize (libserde_derive-1_0_6.hir-plugin.c:35156)
==8962==    by 0x80E940F: _ZN10proc_macro4main (libproc_macro.hir.o.c:5213)
==8962==    by 0x804A8E3: _ZN19serde_derive$$1_0_612proc_macro$H4main (libserde_derive-1_0_6.hir-plugin.c:35252)
==8962==    by 0x808919A: __rust_maybe_catch_panic (libpanic_abort.hir.o.c:142)
==8962==    by 0x80AC36A: _ZN3std9panicking3try$aL$T0$Cfn_0_$T0$aR (libstd.hir.o.c:63752)
==8962== 

valgrind: m_mallocfree.c:307 (get_bszB_as_is): Assertion 'bszB_lo == bszB_hi' failed.
valgrind: Heap block lo/hi size mismatch: lo = 376, hi = 11.
This is probably caused by your program erroneously writing past the
end of a heap block and corrupting heap metadata.  If you fix any
invalid writes reported by Memcheck, this assertion failure will
probably go away.  Please try that before reporting this as a bug.

host stacktrace:
==8962==    at 0x580476F2: show_sched_status_wrk (in /gnu/store/2abrjc69xvbqgs1lgvc8xab3nsd4sbg6-valgrind-3.15.0/lib/valgrind/memcheck-x86-linux)
==8962==    by 0x58047804: report_and_quit (in /gnu/store/2abrjc69xvbqgs1lgvc8xab3nsd4sbg6-valgrind-3.15.0/lib/valgrind/memcheck-x86-linux)
==8962==    by 0x580478E3: vgPlain_assert_fail (in /gnu/store/2abrjc69xvbqgs1lgvc8xab3nsd4sbg6-valgrind-3.15.0/lib/valgrind/memcheck-x86-linux)
==8962==    by 0x58050242: vgPlain_describe_arena_addr (in /gnu/store/2abrjc69xvbqgs1lgvc8xab3nsd4sbg6-valgrind-3.15.0/lib/valgrind/memcheck-x86-linux)
==8962==    by 0x5803E8C8: vgPlain_describe_addr (in /gnu/store/2abrjc69xvbqgs1lgvc8xab3nsd4sbg6-valgrind-3.15.0/lib/valgrind/memcheck-x86-linux)
==8962==    by 0x5803C179: describe_addr (in /gnu/store/2abrjc69xvbqgs1lgvc8xab3nsd4sbg6-valgrind-3.15.0/lib/valgrind/memcheck-x86-linux)
==8962==    by 0x5803D971: vgMemCheck_update_Error_extra (in /gnu/store/2abrjc69xvbqgs1lgvc8xab3nsd4sbg6-valgrind-3.15.0/lib/valgrind/memcheck-x86-linux)
==8962==    by 0x58042181: vgPlain_maybe_record_error (in /gnu/store/2abrjc69xvbqgs1lgvc8xab3nsd4sbg6-valgrind-3.15.0/lib/valgrind/memcheck-x86-linux)
==8962==    by 0x5803CF4B: vgMemCheck_record_address_error (in /gnu/store/2abrjc69xvbqgs1lgvc8xab3nsd4sbg6-valgrind-3.15.0/lib/valgrind/memcheck-x86-linux)
==8962==    by 0x5802220A: mc_LOADVn_slow (in /gnu/store/2abrjc69xvbqgs1lgvc8xab3nsd4sbg6-valgrind-3.15.0/lib/valgrind/memcheck-x86-linux)
==8962==    by 0x833A2DF1: ???

sched status:
  running_tid=1
Thread 1: status = VgTs_Runnable (lwpid 8962)
==8962==    at 0x808DFA2: _ZRK$aL_ZN11collections6string6String_as__ZN4core3ops5Deref$aR5deref (libserde_derive_internals-0_15_0.hir.o.c:34159)
==8962==    by 0x808DFA2: _ZRI$aL_ZN30serde_derive_internals$$0_15_04attr5Field$aR14rename_by_rule (libserde_derive_internals-0_15_0.hir.o.c:29843)
==8962==    by 0x8097312: _ZRI$aL_ZN30serde_derive_internals$$0_15_03ast9Container$aR8from_ast (libserde_derive_internals-0_15_0.hir.o.c:25995)
==8962==    by 0x806D770: _ZN19serde_derive$$1_0_62de25expand_derive_deserialize (libserde_derive-1_0_6.hir-plugin.c:33748)
==8962==    by 0x806E56A: _ZN19serde_derive$$1_0_618derive_deserialize (libserde_derive-1_0_6.hir-plugin.c:35156)
==8962==    by 0x80E940F: _ZN10proc_macro4main (libproc_macro.hir.o.c:5213)
==8962==    by 0x804A8E3: _ZN19serde_derive$$1_0_612proc_macro$H4main (libserde_derive-1_0_6.hir-plugin.c:35252)
==8962==    by 0x808919A: __rust_maybe_catch_panic (libpanic_abort.hir.o.c:142)
==8962==    by 0x80AC36A: _ZN3std9panicking3try$aL$T0$Cfn_0_$T0$aR (libstd.hir.o.c:63752)
==8962==    by 0x80B02A2: _ZN3std2rt10lang_start (libstd.hir.o.c:64534)
==8962==    by 0x804966F: main (libserde_derive-1_0_6.hir-plugin.c:86028)
client stack range: [0xFEAFE000 0xFEB01FFF] client SP: 0xFEB00D00
valgrind stack range: [0x8310F000 0x8320EFFF] top usage: 5340 of 1048576

@thepowersgang
Copy link
Owner

Sorry, I've not put any time into tracing the root cause of this bug (instead been focussing on the 1.29 branch, which includes a lot of general compiler fixes).

Can you confirm that the above failure still happens on 3f44cec (current HEAD of master)? And if so, provide the gcc version and platform used. I can't reproduce the crash (or the memcheck issues) on my 32-bit debian install using the same macro invocation.

@daym
Copy link
Contributor Author

daym commented May 11, 2019

The above failure does not happen on 3f44cec, but the compiler rustc 1.19.0 compiled via that mrustc does die with a signal when it is used. The following logs are all from a 3f44cec run.

Backtrace of first run_rustc command from a manual attempt ("x86_64-unknown-linux-gnu" is just because I didn't edit run_rustc's Makefile, it's actually i686):

$ ../output/rustc  -L prefix/lib/rustlib/x86_64-unknown-linux-gnu/lib/ -L ../output/libs ../rustc-1.19.0-src/src/libcore/lib.rs -o prefix/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore.rlib
Aborted
$ gdb --args ../output/rustc  -L prefix/lib/rustlib/x86_64-unknown-linux-gnu/lib/ -L ../output/libs ../rustc-1.19.0-src/src/libcore/lib.rs -o prefix/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore.rlib
(gdb) r
Starting program: /home/dannym/src/mrustc/master-32-3/mrustc/output/rustc -L prefix/lib/rustlib/x86_64-unknown-linux-gnu/lib/ -L ../output/libs ../rustc-1.19.0-src/src/libcore/lib.rs -o prefix/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore.rlib
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/gnu/store/qk8irm5yp2khq4dj7zcpcaa1g87pfyvw-glibc-2.28/lib/libthread_db.so.1".
[New Thread 0xf7b11b40 (LWP 9859)]

Thread 2 "rustc" received signal SIGABRT, Aborted.
[Switching to Thread 0xf7b11b40 (LWP 9859)]
0xf7fd4949 in __kernel_vsyscall ()
(gdb) bt
#0  0xf7fd4949 in __kernel_vsyscall ()
#1  0xf7b64a60 in raise () from /gnu/store/qk8irm5yp2khq4dj7zcpcaa1g87pfyvw-glibc-2.28/lib/libc.so.6
#2  0xf7b65bd7 in abort () from /gnu/store/qk8irm5yp2khq4dj7zcpcaa1g87pfyvw-glibc-2.28/lib/libc.so.6
#3  0x083cfe2f in _ZRK$aL_ZN4core6option6Option$aL_ZN10syntax_pos6symbol5Ident$aR_as__ZN4core3cmp9PartialEq$aL_ZN4core6option6Option$aL_ZN10syntax_pos6symbol5Ident$aR$aR$aR2eq (arg1=0xf7b05834, arg0=<optimized out>) at output/rustc-build/libsyntax_ext.hir.o.c:236913
#4  _ZRK$aL_ZN10syntax_ext12closure_I_36$aL_ZN10syntax_ext8deriving7generic9MethodDef$aR_as__ZN4core3ops2Fn$aL$T1_$Rs__ZN11collections3vec3Vec$aL$T4__ZN10syntax_pos4Span__ZN4core6option6Option$aL_ZN10syntax_pos6symbol5Ident$aR__ZN6syntax3ptr1P$aL_ZN6syntax3ast4Expr$aR_$Rs_$A__ZN6syntax3ast9Attribute$aR$aR$aR4call (arg0=0xf7b058b8, arg1=...) at output/rustc-build/libsyntax_ext.hir.o.c:5473
#5  0x083cff4e in _ZRI$aL_ZN4core6option6Option$aL$Rs__ZN11collections3vec3Vec$aL$T4__ZN10syntax_pos4Span__ZN4core6option6Option$aL_ZN10syntax_pos6symbol5Ident$aR__ZN6syntax3ptr1P$aL_ZN6syntax3ast4Expr$aR_$Rs_$A__ZN6syntax3ast9Attribute$aR$aR$aR3map$aL_ZN6syntax3ptr1P$aL_ZN6syntax3ast4Expr$aR$C$Ru__ZN10syntax_ext12closure_I_36$aL_ZN10syntax_ext8deriving7generic9MethodDef$aR$aR (arg1=0xf7b058b8, arg0=...) at output/rustc-build/libsyntax_ext.hir.o.c:149157
#6  _ZRK$aL_ZN4core4iter3Map$aL_ZN4core5slice4Iter$aL_ZN11collections3vec3Vec$aL$T4__ZN10syntax_pos4Span__ZN4core6option6Option$aL_ZN10syntax_pos6symbol5Ident$aR__ZN6syntax3ptr1P$aL_ZN6syntax3ast4Expr$aR_$Rs_$A__ZN6syntax3ast9Attribute$aR$aR$C_ZN10syntax_ext12closure_I_36$aL_ZN10syntax_ext8deriving7generic9MethodDef$aR$aR_as__ZN4core4iter8iterator8Iterator$aR4next (arg0=0xf7b058b0) at output/rustc-build/libsyntax_ext.hir.o.c:34303
#7  _ZRK$aL_ZN11collections3vec3Vec$aL_ZN6syntax3ptr1P$aL_ZN6syntax3ast4Expr$aR$aR_as__ZN11collections3vec10SpecExtend$aL_ZN6syntax3ptr1P$aL_ZN6syntax3ast4Expr$aR$C_ZN4core4iter3Map$aL_ZN4core5slice4Iter$aL_ZN11collections3vec3Vec$aL$T4__ZN10syntax_pos4Span__ZN4core6option6Option$aL_ZN10syntax_pos6symbol5Ident$aR__ZN6syntax3ptr1P$aL_ZN6syntax3ast4Expr$aR_$Rs_$A__ZN6syntax3ast9Attribute$aR$aR$C_ZN10syntax_ext12closure_I_36$aL_ZN10syntax_ext8deriving7generic9MethodDef$aR$aR$aR$aR11spec_extend (arg1=..., arg0=0xf7b058a4) at output/rustc-build/libsyntax_ext.hir.o.c:14457
#8  _ZRK$aL_ZN11collections3vec3Vec$aL_ZN6syntax3ptr1P$aL_ZN6syntax3ast4Expr$aR$aR_as__ZN11collections3vec10SpecExtend$aL_ZN6syntax3ptr1P$aL_ZN6syntax3ast4Expr$aR$C_ZN4core4iter3Map$aL_ZN4core5slice4Iter$aL_ZN11collections3vec3Vec$aL$T4__ZN10syntax_pos4Span__ZN4core6option6Option$aL_ZN10syntax_pos6symbol5Ident$aR__ZN6syntax3ptr1P$aL_ZN6syntax3ast4Expr$aR_$Rs_$A__ZN6syntax3ast9Attribute$aR$aR$C_ZN10syntax_ext12closure_I_36$aL_ZN10syntax_ext8deriving7generic9MethodDef$aR$aR$aR$aR9from_iter (arg0=...) at output/rustc-build/libsyntax_ext.hir.o.c:14252
#9  _ZRK$aL_ZN10syntax_ext12closure_I_37$aL_ZN10syntax_ext8deriving7generic9MethodDef$aR_as__ZN4core3ops2Fn$aL$T1_$T2_usize_$T4__ZN10syntax_pos4Span__ZN4core6option6Option$aL_ZN10syntax_pos6symbol5Ident$aR__ZN6syntax3ptr1P$aL_ZN6syntax3ast4Expr$aR_$Rs_$A__ZN6syntax3ast9Attribute$aR$aR4call (arg0=0xf7b059dc, arg1=...) at output/rustc-build/libsyntax_ext.hir.o.c:5543
#10 0x083d3ee8 in _ZRI$aL_ZN4core6option6Option$aL$T2_usize_$T4__ZN10syntax_pos4Span__ZN4core6option6Option$aL_ZN10syntax_pos6symbol5Ident$aR__ZN6syntax3ptr1P$aL_ZN6syntax3ast4Expr$aR_$Rs_$A__ZN6syntax3ast9Attribute$aR$aR3map$aL_ZN10syntax_ext8deriving7generic9FieldInfo$C$Ru__ZN10syntax_ext12closure_I_37$aL_ZN10syntax_ext8deriving7generic9MethodDef$aR$aR (arg1=0xf7b059dc, arg0=...) at output/rustc-build/libsyntax_ext.hir.o.c:148187
#11 _ZRK$aL_ZN4core4iter3Map$aL_ZN4core4iter9Enumerate$aL_ZN11collections3vec8IntoIter$aL$T4__ZN10syntax_pos4Span__ZN4core6option6Option$aL_ZN10syntax_pos6symbol5Ident$aR__ZN6syntax3ptr1P$aL_ZN6syntax3ast4Expr$aR_$Rs_$A__ZN6syntax3ast9Attribute$aR$aR$C_ZN10syntax_ext12closure_I_37$aL_ZN10syntax_ext8deriving7generic9MethodDef$aR$aR_as__ZN4core4iter8iterator8Iterator$aR4next (arg0=0xf7b059c8) at output/rustc-build/libsyntax_ext.hir.o.c:33515
#12 _ZRK$aL_ZN11collections3vec3Vec$aL_ZN10syntax_ext8deriving7generic9FieldInfo$aR_as__ZN11collections3vec10SpecExtend$aL_ZN10syntax_ext8deriving7generic9FieldInfo$C_ZN4core4iter3Map$aL_ZN4core4iter9Enumerate$aL_ZN11collections3vec8IntoIter$aL$T4__ZN10syntax_pos4Span__ZN4core6option6Option$aL_ZN10syntax_pos6symbol5Ident$aR__ZN6syntax3ptr1P$aL_ZN6syntax3ast4Expr$aR_$Rs_$A__ZN6syntax3ast9Attribute$aR$aR$C_ZN10syntax_ext12closure_I_37$aL_ZN10syntax_ext8deriving7generic9MethodDef$aR$aR$aR$aR11spec_extend (arg1=..., arg0=<optimized out>) at output/rustc-build/libsyntax_ext.hir.o.c:22572
#13 _ZRK$aL_ZN11collections3vec3Vec$aL_ZN10syntax_ext8deriving7generic9FieldInfo$aR_as__ZN11collections3vec10SpecExtend$aL_ZN10syntax_ext8deriving7generic9FieldInfo$C_ZN4core4iter3Map$aL_ZN4core4iter9Enumerate$aL_ZN11collections3vec8IntoIter$aL$T4__ZN10syntax_pos4Span__ZN4core6option6Option$aL_ZN10syntax_pos6symbol5Ident$aR__ZN6syntax3ptr1P$aL_ZN6syntax3ast4Expr$aR_$Rs_$A__ZN6syntax3ast9Attribute$aR$aR$C_ZN10syntax_ext12closure_I_37$aL_ZN10syntax_ext8deriving7generic9MethodDef$aR$aR$aR$aR9from_iter (arg0=...) at output/rustc-build/libsyntax_ext.hir.o.c:22368
#14 _ZRK$aL_ZN10syntax_ext12closure_I_38$aL_ZN10syntax_ext8deriving7generic9MethodDef$aR_as__ZN4core3ops5FnMut$aL$T1_$T2_usize_$Rs__ZN6syntax7codemap7Spanned$aL_ZN6syntax3ast8Variant_$aR$aR$aR8call_mut (arg0=0xf7b05e28, arg1=...) at output/rustc-build/libsyntax_ext.hir.o.c:5746
#15 0x083d4308 in _ZRI$aL_ZN4core6option6Option$aL$T2_usize_$Rs__ZN6syntax7codemap7Spanned$aL_ZN6syntax3ast8Variant_$aR$aR$aR3map$aL_ZN6syntax3ast3Arm$C$Ru__ZN10syntax_ext12closure_I_38$aL_ZN10syntax_ext8deriving7generic9MethodDef$aR$aR (arg1=0xf7b05e28, arg0=...) at output/rustc-build/libsyntax_ext.hir.o.c:148229
#16 _ZRK$aL_ZN4core4iter3Map$aL_ZN4core4iter6Filter$aL_ZN4core4iter9Enumerate$aL_ZN4core5slice4Iter$aL_ZN6syntax7codemap7Spanned$aL_ZN6syntax3ast8Variant_$aR$aR$aR$C_ZN10syntax_ext12closure_I_34$aL_ZN10syntax_ext8deriving7generic9MethodDef$aR$aR$C_ZN10syntax_ext12closure_I_38$aL_ZN10syntax_ext8deriving7generic9MethodDef$aR$aR_as__ZN4core4iter8iterator8Iterator$aR4next (arg0=arg0@entry=0xf7b05e18) at output/rustc-build/libsyntax_ext.hir.o.c:33839
#17 0x083d48d9 in _ZRK$aL_ZN11collections3vec3Vec$aL_ZN6syntax3ast3Arm$aR_as__ZN11collections3vec10SpecExtend$aL_ZN6syntax3ast3Arm$C_ZN4core4iter3Map$aL_ZN4core4iter6Filter$aL_ZN4core4iter9Enumerate$aL_ZN4core5slice4Iter$aL_ZN6syntax7codemap7Spanned$aL_ZN6syntax3ast8Variant_$aR$aR$aR$C_ZN10syntax_ext12closure_I_34$aL_ZN10syntax_ext8deriving7generic9MethodDef$aR$aR$C_ZN10syntax_ext12closure_I_38$aL_ZN10syntax_ext8deriving7generic9MethodDef$aR$aR$aR$aR9from_iter (arg0=...) at output/rustc-build/libsyntax_ext.hir.o.c:192742
#18 _ZRI$aL_ZN10syntax_ext8deriving7generic9MethodDef$aR22build_enum_match_tuple (arg0=<optimized out>, arg1=<optimized out>, arg2=<optimized out>, arg3=0xf40f09a8, arg4=..., arg5=..., arg6=..., arg7=...) at output/rustc-build/libsyntax_ext.hir.o.c:34654
#19 0x083e303e in _ZRK$aL_ZN10syntax_ext12closure_I_26$aL_ZN10syntax_ext8deriving7generic8TraitDef$aR_as__ZN4core3ops5FnMut$aL$T1_$Rs__ZN10syntax_ext8deriving7generic9MethodDef$aR$aR8call_mut (arg0=0xf7b06014, arg1=...) at output/rustc-build/libsyntax_ext.hir.o.c:266866
#20 0x083e3367 in _ZRI$aL_ZN4core6option6Option$aL$Rs__ZN10syntax_ext8deriving7generic9MethodDef$aR$aR3map$aL_ZN6syntax3ast8ImplItem$C$Ru__ZN10syntax_ext12closure_I_26$aL_ZN10syntax_ext8deriving7generic8TraitDef$aR$aR (arg1=0xf7b06014, arg0=...) at output/rustc-build/libsyntax_ext.hir.o.c:150481
#21 _ZRK$aL_ZN4core4iter3Map$aL_ZN4core5slice4Iter$aL_ZN10syntax_ext8deriving7generic9MethodDef$aR$C_ZN10syntax_ext12closure_I_26$aL_ZN10syntax_ext8deriving7generic8TraitDef$aR$aR_as__ZN4core4iter8iterator8Iterator$aR4next (arg0=0xf7b0600c) at output/rustc-build/libsyntax_ext.hir.o.c:35068
#22 _ZRK$aL_ZN11collections3vec3Vec$aL_ZN6syntax3ast8ImplItem$aR_as__ZN11collections3vec10SpecExtend$aL_ZN6syntax3ast8ImplItem$C_ZN4core4iter3Map$aL_ZN4core5slice4Iter$aL_ZN10syntax_ext8deriving7generic9MethodDef$aR$C_ZN10syntax_ext12closure_I_26$aL_ZN10syntax_ext8deriving7generic8TraitDef$aR$aR$aR$aR11spec_extend (arg0=arg0@entry=0xf7b06410, arg1=...) at output/rustc-build/libsyntax_ext.hir.o.c:65272
#23 0x083e35fb in _ZRK$aL_ZN11collections3vec3Vec$aL_ZN6syntax3ast8ImplItem$aR_as__ZN11collections3vec10SpecExtend$aL_ZN6syntax3ast8ImplItem$C_ZN4core4iter3Map$aL_ZN4core5slice4Iter$aL_ZN10syntax_ext8deriving7generic9MethodDef$aR$C_ZN10syntax_ext12closure_I_26$aL_ZN10syntax_ext8deriving7generic8TraitDef$aR$aR$aR$aR9from_iter (arg0=...) at output/rustc-build/libsyntax_ext.hir.o.c:196139
#24 _ZRI$aL_ZN10syntax_ext8deriving7generic8TraitDef$aR15expand_enum_def (arg0=<optimized out>, arg1=<optimized out>, arg2=<optimized out>, arg3=..., arg4=..., arg5=<optimized out>, arg6=<optimized out>) at output/rustc-build/libsyntax_ext.hir.o.c:37401
#25 0x083e4010 in _ZRI$aL_ZN10syntax_ext8deriving7generic8TraitDef$aR10expand_ext (arg0=0xf7b06a54, arg1=0xf7b08be4, arg2=0xf7b06c84, arg3=0xf7b06b54, arg4=..., arg5=false) at output/rustc-build/libsyntax_ext.hir.o.c:168651
#26 0x083e7a7d in _ZN10syntax_ext8deriving10partial_eq26expand_deriving_partial_eq (arg0=0xf7b08be4, arg1=..., arg2=0xf7b06c84, arg3=0xf7b06b54, arg4=...) at output/rustc-build/libsyntax_ext.hir.o.c:105591
#27 0x08580abb in _ZRI$aL_ZN6syntax3ext6expand13MacroExpander$aR19expand_derive_invoc (arg0=0xf7b08b24, arg1=..., arg2=...) at output/rustc-build/libsyntax.hir.o.c:413575
#28 0x086673bc in _ZRI$aL_ZN6syntax3ext6expand13MacroExpander$aR12expand_invoc (arg0=0xf7b08b24, arg1=..., arg2=...) at output/rustc-build/libsyntax.hir.o.c:413710
#29 0x08696be4 in _ZRI$aL_ZN6syntax3ext6expand13MacroExpander$aR6expand (arg0=<optimized out>, arg1=...) at output/rustc-build/libsyntax.hir.o.c:411356
#30 0x08699237 in _ZRI$aL_ZN6syntax3ext6expand13MacroExpander$aR12expand_crate (arg0=0xf7b08b24, arg1=...) at output/rustc-build/libsyntax.hir.o.c:413175
#31 0x0849247c in _ZRK$aL_ZN12rustc_driver6driver10closure_21$aL_ZN12rustc_driver6driver9closure_3$aR_as__ZN4core3ops6FnOnce$aL$T0$aR$aR9call_once (arg0=..., arg1=...) at output/rustc-build/librustc_driver.hir.o.c:419875
#32 0x08498183 in _ZN5rustc4util6common4time$aL_ZN6syntax3ast5Crate$C_ZN12rustc_driver6driver10closure_21$aL_ZN12rustc_driver6driver9closure_3$aR$aR (arg2=..., arg1=..., arg0=false) at output/rustc-build/librustc_driver.hir.o.c:168275
#33 _ZN12rustc_driver6driver28phase_2_configure_and_expand$aL_ZN12rustc_driver6driver9closure_3$aR (arg0=<optimized out>, arg1=<optimized out>, arg2=..., arg3=..., arg4=..., arg5=..., arg6=..., arg7=...) at output/rustc-build/librustc_driver.hir.o.c:52599
#34 0x084a4ae0 in _ZN12rustc_driver6driver13compile_input (arg0=<optimized out>, arg1=<optimized out>, arg2=<optimized out>, arg3=<optimized out>, arg4=<optimized out>, arg5=..., arg6=<optimized out>) at output/rustc-build/librustc_driver.hir.o.c:182386
#35 0x084a7219 in _ZN12rustc_driver12run_compiler (arg0=..., arg1=..., arg2=..., arg3=...) at output/rustc-build/librustc_driver.hir.o.c:190429
#36 0x084a7516 in _ZRK$aL_ZN12rustc_driver10closure_13_as__ZN4core3ops2Fn$aL$T0$aR$aR4call (arg0=0xf7b11260, arg1=...) at output/rustc-build/librustc_driver.hir.o.c:415253
#37 0x084a7564 in _ZRK$aL_ZN12rustc_driver9closure_4$aL_ZN12rustc_driver10closure_13$aR_as__ZN4core3ops6FnOnce$aL$T0$aR$aR9call_once (arg0=..., arg1=...) at output/rustc-build/librustc_driver.hir.o.c:416765
#38 0x084a7845 in _ZRK$aL_ZN12rustc_driver10closure_14$aL_ZN12rustc_driver9closure_4$aL_ZN12rustc_driver10closure_13$aR$aR_as__ZN4core3ops6FnOnce$aL$T0$aR$aR9call_once (arg0=..., arg1=...) at output/rustc-build/librustc_driver.hir.o.c:415359
#39 0x084a7870 in _ZN3std9panicking3$H37do_call$aL_ZN3std5panic16AssertUnwindSafe$aL_ZN12rustc_driver10closure_14$aL_ZN12rustc_driver9closure_4$aL_ZN12rustc_driver10closure_13$aR$aR$aR$C$T0$aR (arg0=0xf7b112d0 "\260\330\016\v") at output/rustc-build/librustc_driver.hir.o.c:194404
#40 0x08bddbcb in __rust_maybe_catch_panic (arg0=0x84a7860 <_ZN3std9panicking3$H37do_call$aL_ZN3std5panic16AssertUnwindSafe$aL_ZN12rustc_driver10closure_14$aL_ZN12rustc_driver9closure_4$aL_ZN12rustc_driver10closure_13$aR$aR$aR$C$T0$aR>, arg1=0xf7b112d0 "\260\330\016\v", arg2=0xf7b112c8, arg3=0xf7b112cc) at output/libpanic_abort.hir.o.c:146
#41 0x0842fa81 in _ZN3std9panicking3try$aL$T0$C_ZN3std5panic16AssertUnwindSafe$aL_ZN12rustc_driver10closure_14$aL_ZN12rustc_driver9closure_4$aL_ZN12rustc_driver10closure_13$aR$aR$aR$aR (arg0=...) at output/rustc-build/librustc_driver.hir.o.c:194526
#42 _ZRK$aL_ZN3std11closure_I_3$aL_ZN3std6thread7Builder$C_ZN12rustc_driver10closure_14$aL_ZN12rustc_driver9closure_4$aL_ZN12rustc_driver10closure_13$aR$aR$C$T0$aR_as__ZN4core3ops6FnOnce$aL$T0$aR$aR9call_once (arg0=..., arg1=...) at output/rustc-build/librustc_driver.hir.o.c:18247
#43 _ZRK$aL_ZN3std11closure_I_3$aL_ZN3std6thread7Builder$C_ZN12rustc_driver10closure_14$aL_ZN12rustc_driver9closure_4$aL_ZN12rustc_driver10closure_13$aR$aR$C$T0$aR_as__ZN5alloc5boxed5FnBox$aL$T0$aR$aR8call_box (arg0=..., arg1=...) at output/rustc-build/librustc_driver.hir.o.c:18182
#44 0x080daf6a in _ZN3std10sys_common6thread12start_thread (arg0=0xb0edae0) at output/libstd.hir.o.c:79169
#45 0x080daf9c in _ZN3std3sys3imp6thread3$H012thread_start (arg0=0xb0edae0) at output/libstd.hir.o.c:75615
#46 0xf7fa3fdb in start_thread () from /gnu/store/qk8irm5yp2khq4dj7zcpcaa1g87pfyvw-glibc-2.28/lib/libpthread.so.0
#47 0xf7c2b5f6 in clone () from /gnu/store/qk8irm5yp2khq4dj7zcpcaa1g87pfyvw-glibc-2.28/lib/libc.so.6
[...]
(gdb) print (*var5).TAG
$2 = 96 '`'

That location contains:

// <::"core"::option::Option<::"syntax_pos"::symbol::Ident/*S*/,>/*E*/ as ::"core"::cmp::PartialEq<::"core"::option::Option<::"syntax_pos"::symbol::Ident/*S*/,
>/*E*/,>>::eq
static bool  _ZRK$aL_ZN4core6option6Option$aL_ZN10syntax_pos6symbol5Ident$aR_as__ZN4core3cmp9PartialEq$aL_ZN4core6option6Option$aL_ZN10syntax_pos6symbol5Ident$
aR$aR$aR2eq(
                struct e__ZN4core6option6Option$aL_ZN10syntax_pos6symbol5Ident$aR *arg0,
                struct e__ZN4core6option6Option$aL_ZN10syntax_pos6symbol5Ident$aR *arg1
                )
{
        bool rv;
        struct s__ZN10syntax_pos6symbol5Ident *var0;    // &::"syntax_pos"::symbol::Ident/*S*/
        struct s__ZN10syntax_pos6symbol5Ident *var1;    // &::"syntax_pos"::symbol::Ident/*S*/
        bool var2;      // bool
        struct s__ZN10syntax_pos6symbol5Ident **var3;   // &&::"syntax_pos"::symbol::Ident/*S*/
        struct s__ZN10syntax_pos6symbol5Ident **var4;   // &&::"syntax_pos"::symbol::Ident/*S*/
        struct e__ZN4core6option6Option$aL_ZN10syntax_pos6symbol5Ident$aR *var5;        // &::"core"::option::Option<::"syntax_pos"::symbol::Ident/*S*/,>/*E*/
        struct e__ZN4core6option6Option$aL_ZN10syntax_pos6symbol5Ident$aR *var6;        // &::"core"::option::Option<::"syntax_pos"::symbol::Ident/*S*/,>/*E*/
        bool var7;      // bool
        bool var8;      // bool
        var5 = arg0;    // Local(5) = Use(Argument(0))
        var6 = arg1;    // Local(6) = Use(Argument(1))
        switch((*var5).TAG) {
        case 0: goto bb1;break;
        case 1: goto bb2;break;
        default: abort(); <----   problem here
        }

Valgrind reports no errors before the abort.

Using the rustc 1.19.0 compiler above to compile a toy program results in:

$ cat a.rs
#![no_std]
#![no_core]
#![feature(start, no_core)]
#![feature(lang_items)]

#[lang="sized"]
trait Sized {}

#[lang="copy"] 
trait Copy {}

#[start]
fn start(argc: isize, argv: *const *const u8) -> isize {
        0
}
$ ../output/rustc -Z force-unstable-if-unmarked a.rs
[... warnings]
(gdb) bt
#0  0xf7fd4949 in __kernel_vsyscall ()
#1  0xf7b64a60 in raise () from /gnu/store/qk8irm5yp2khq4dj7zcpcaa1g87pfyvw-glibc-2.28/lib/libc.so.6
#2  0xf7b65bd7 in abort () from /gnu/store/qk8irm5yp2khq4dj7zcpcaa1g87pfyvw-glibc-2.28/lib/libc.so.6
h#3  0x083932c4 in _ZRK$aL_ZN10rustc_llvm3ffi8TypeKind_as__ZN4core3cmp9PartialEq$aL_ZN10rustc_llvm3ffi8TypeKind$aR$aR2eq (arg0=0xf7b04de4, arg1=0xf7b04de8) at output/rustc-build/librustc_llvm.hir.o.c:14136
#4  0x08279287 in _ZRI$aL_ZN11rustc_trans7builder7Builder$aR10check_call (arg0=<optimized out>, arg1=..., arg2=<optimized out>, arg3=...) at output/rustc-build/librustc_trans.hir.o.c:387672
#5  0xf7b05034 in ?? ()
#6  0xf7b051e4 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Then we tried our package recipe that worked before for 0.8.0 x86_64, tried it on i686-linux with the mrustc commit 3f44cec (the rustc calls for libcore have a lot more options specified), and we get:

mrustc proceeds until it tries to use the newly-built rustc compiler to build libcore, then we get

GNU gdb (GDB) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "i686-unknown-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /tmp/guix-build-rust-1.19.0.drv-0/rustc-1.19.0-src/output/rustc-build/rustc...done.
�[?1034h(gdb) r
Starting program: /tmp/guix-build-rust-1.19.0.drv-0/rustc-1.19.0-src/output/rustc-build/rustc -C linker=gcc -Z force-unstable-if-unmarked -L output/target-libs src/libcore/lib.rs -o output/target-libs/libcore.rlib
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/gnu/store/qk8irm5yp2khq4dj7zcpcaa1g87pfyvw-glibc-2.28/lib/libthread_db.so.1".
[New Thread 0xf4e54b40 (LWP 14381)]

Thread 2 "rustc" received signal SIGFPE, Arithmetic exception.
[Switching to Thread 0xf4e54b40 (LWP 14381)]
0x086626b4 in _ZRK$aLf32_as__ZN4core3num7dec2flt5rawfp8RawFloat$aR8from_int ()
(gdb) bt
#0  0x086626b4 in _ZRK$aLf32_as__ZN4core3num7dec2flt5rawfp8RawFloat$aR8from_int ()
#1  0x0870f105 in _ZN4core3num7dec2flt9algorithm9fast_path$aLf32$aR (arg2=0, arg1=..., arg0=...) at output/rustc-build/librustc_const_eval.hir.o.c:87234
#2  _ZN4core3num7dec2flt7convert$aLf32$aR (arg0=...) at output/rustc-build/librustc_const_eval.hir.o.c:22655
#3  _ZN4core3num7dec2flt7dec2flt$aLf32$aR (arg0=...) at output/rustc-build/librustc_const_eval.hir.o.c:22954
#4  _ZN16rustc_const_eval4eval11parse_float (arg0=..., arg1=...) at output/rustc-build/librustc_const_eval.hir.o.c:59348
#5  0x0870f62e in _ZN16rustc_const_eval4eval12lit_to_const (arg0=0xeab23680, arg1=..., arg2=<optimized out>) at output/rustc-build/librustc_const_eval.hir.o.c:124498
#6  0x0871cc82 in _ZN16rustc_const_eval4eval23eval_const_expr_partial (arg0=0xf4e49a8c, arg1=0xeab236b0) at output/rustc-build/librustc_const_eval.hir.o.c:120363
#7  0x08726e57 in _ZRI$aL_ZN16rustc_const_eval4eval12ConstContext$aR4eval (arg0=0xf4e49a8c, arg1=0xeab236b0) at output/rustc-build/librustc_const_eval.hir.o.c:172241
#8  0x0871cc11 in _ZN16rustc_const_eval4eval23eval_const_expr_partial (arg0=0xf4e49a8c, arg1=0xf3dadd3c) at output/rustc-build/librustc_const_eval.hir.o.c:120340
#9  0x08726e57 in _ZRI$aL_ZN16rustc_const_eval4eval12ConstContext$aR4eval (arg0=0xf4e49a8c, arg1=0xf3dadd3c) at output/rustc-build/librustc_const_eval.hir.o.c:172241
#10 0x08743b8b in _ZRI$aL_ZN12rustc_passes6consts17CheckCrateVisitor$aR16check_const_eval (arg0=0xf4e4a91c, arg1=0xf3dadd3c) at output/rustc-build/librustc_passes.hir.o.c:162827
#11 0x0874c635 in _ZRK$aL_ZN12rustc_passes6consts17CheckCrateVisitor_as__ZN5rustc3hir10intravisit7Visitor$aR17visit_nested_body (arg0=0xf4e4a91c, arg1=...) at output/rustc-build/librustc_passes.hir.o.c:246979
#12 0x0874e261 in _ZN5rustc3hir10intravisit7walk_fn$aL_ZN12rustc_passes6consts17CheckCrateVisitor$aR (arg3=..., arg2=<optimized out>, arg0=<optimized out>, arg1=..., arg4=..., arg5=...) at output/rustc-build/librustc_passes.hir.o.c:92103
#13 _ZN5rustc3hir10intravisit9walk_item$aL_ZN12rustc_passes6consts17CheckCrateVisitor$aR (arg0=arg0@entry=0xf4e4a91c, arg1=arg1@entry=0xeab23b5c) at output/rustc-build/librustc_passes.hir.o.c:30636
#14 0x0874e869 in _ZRI$aL_ZN5rustc3hir5Crate$aR20visit_all_item_likes$aL_ZN5rustc3hir13itemlikevisit11DeepVisitor$aL_ZN12rustc_passes6consts17CheckCrateVisitor$aR$aR (arg1=<synthetic pointer>, arg0=0xf4e4e014) at output/rustc-build/librustc_passes.hir.o.c:160677
#15 _ZN12rustc_passes6consts11check_crate (arg0=...) at output/rustc-build/librustc_passes.hir.o.c:46681
#16 0x08615dbe in _ZN5rustc4util6common4time$aL$T0$C_ZN12rustc_driver6driver10closure_51$aL_ZN12rustc_driver6driver10closure_22$C_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$aR$aR (arg2=..., arg1=..., arg0=<optimized out>) at output/rustc-build/librustc_driver.hir.o.c:174926
#17 _ZRK$aL_ZN12rustc_driver6driver10closure_62$aL_ZN12rustc_driver6driver10closure_22$C_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$aR_as__ZN4core3ops6FnOnce$aL$T1__ZN5rustc2ty7context6TyCtxt$aR$aR9call_once (arg0=..., arg1=...) at output/rustc-build/librustc_driver.hir.o.c:32426
#18 0x08619ed4 in _ZRK$aL_ZN5rustc2ty7context3tls9closure_0$aL_ZN12rustc_driver6driver10closure_62$aL_ZN12rustc_driver6driver10closure_22$C_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$aR$C_ZN4core6result6Result$aL_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$Cusize$aR$aR_as__ZN4core3ops6FnOnce$aL$T1_$Rs__ZN4core4cell4Cell$aL_ZN4core6option6Option$aL$T2_$Ss__ZN5rustc2ty7context3tls21ThreadLocalGlobalCtxt_$Ss__ZN5rustc2ty7context3tls20ThreadLocalInterners$aR$aR$aR$aR9call_once (arg1=..., arg0=...) at output/rustc-build/librustc_driver.hir.o.c:401785
#19 _ZRI$aL_ZN3std6thread5local8LocalKey$aL_ZN4core4cell4Cell$aL_ZN4core6option6Option$aL$T2_$Ss__ZN5rustc2ty7context3tls21ThreadLocalGlobalCtxt_$Ss__ZN5rustc2ty7context3tls20ThreadLocalInterners$aR$aR$aR$aR4with$aL_ZN5rustc2ty7context3tls9closure_0$aL_ZN12rustc_driver6driver10closure_62$aL_ZN12rustc_driver6driver10closure_22$C_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$aR$C_ZN4core6result6Result$aL_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$Cusize$aR$aR$C_ZN4core6result6Result$aL_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$Cusize$aR$aR (arg0=<optimized out>, arg1=...) at output/rustc-build/librustc_driver.hir.o.c:44308
#20 _ZN5rustc2ty7context3tls5enter$aL_ZN12rustc_driver6driver10closure_62$aL_ZN12rustc_driver6driver10closure_22$C_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$aR$C_ZN4core6result6Result$aL_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$Cusize$aR$aR (arg2=..., arg1=0xf4e4cc68, arg0=0xf4e4cc64) at output/rustc-build/librustc_driver.hir.o.c:30856
#21 _ZRK$aL_ZN5rustc2ty7context3tls9closure_4$aL_ZN12rustc_driver6driver10closure_62$aL_ZN12rustc_driver6driver10closure_22$C_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$aR$C_ZN4core6result6Result$aL_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$Cusize$aR$aR_as__ZN4core3ops6FnOnce$aL$T1_$Rs__ZN4core4cell4Cell$aLfn_2__ZN10syntax_pos4Span_$Ru__ZN4core3fmt9Formatter__ZN4core6result6Result$aL$T0$C_ZN4core3fmt5Error$aR$aR$aR$aR9call_once (arg1=..., arg0=...) at output/rustc-build/librustc_driver.hir.o.c:8742
#22 _ZRI$aL_ZN3std6thread5local8LocalKey$aL_ZN4core4cell4Cell$aLfn_2__ZN10syntax_pos4Span_$Ru__ZN4core3fmt9Formatter__ZN4core6result6Result$aL$T0$C_ZN4core3fmt5Error$aR$aR$aR$aR4with$aL_ZN5rustc2ty7context3tls9closure_4$aL_ZN12rustc_driver6driver10closure_62$aL_ZN12rustc_driver6driver10closure_22$C_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$aR$C_ZN4core6result6Result$aL_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$Cusize$aR$aR$C_ZN4core6result6Result$aL_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$Cusize$aR$aR (arg0=<optimized out>, arg1=...) at output/rustc-build/librustc_driver.hir.o.c:44559
#23 _ZRI$aL_ZN5rustc2ty7context6TyCtxt$aR16create_and_enter$aL_ZN12rustc_driver6driver10closure_62$aL_ZN12rustc_driver6driver10closure_22$C_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$aR$C_ZN4core6result6Result$aL_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$Cusize$aR$aR (arg12=..., arg11=..., arg10=..., arg9=..., arg8=..., arg7=..., arg6=..., arg5=0xf4e4db04, arg4=0xf4e4e154, arg3=..., arg2=..., arg1=..., arg0=<optimized out>) at output/rustc-build/librustc_driver.hir.o.c:64821
#24 _ZN12rustc_driver6driver27phase_3_run_analysis_passes$aL_ZN12rustc_driver6driver10closure_22$C_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$aR (arg0=0xf4e50298, arg1=..., arg2=..., arg3=..., arg4=0xf4e4db04, arg5=0xf4e4e154, arg6=..., arg7=...) at output/rustc-build/librustc_driver.hir.o.c:54405
#25 0x08620dc5 in _ZN12rustc_driver6driver13compile_input (arg0=0xf4e50298, arg1=0xf3d011d8, arg2=0xf4e4f92c, arg3=0xf4e4f894, arg4=0xf4e4f8a0, arg5=..., arg6=0xf4e4fa94) at output/rustc-build/librustc_driver.hir.o.c:182722
#26 0x08621e4d in _ZN12rustc_driver12run_compiler (arg0=..., arg1=..., arg2=..., arg3=...) at output/rustc-build/librustc_driver.hir.o.c:190576
#27 0x086223c6 in _ZRK$aL_ZN12rustc_driver9closure_0_as__ZN4core3ops2Fn$aL$T0$aR$aR4call (arg0=0xf4e54210, arg1=...) at output/rustc-build/librustc_driver.hir.o.c:414960
#28 0x08622414 in _ZRK$aL_ZN12rustc_driver10closure_25$aL_ZN12rustc_driver9closure_0$aR_as__ZN4core3ops6FnOnce$aL$T0$aR$aR9call_once (arg0=..., arg1=...) at output/rustc-build/librustc_driver.hir.o.c:416792
#29 0x086226ee in _ZRK$aL_ZN12rustc_driver10closure_13$aL_ZN12rustc_driver10closure_25$aL_ZN12rustc_driver9closure_0$aR$aR_as__ZN4core3ops6FnOnce$aL$T0$aR$aR9call_once (arg0=..., arg1=...) at output/rustc-build/librustc_driver.hir.o.c:415463
#30 0x08622720 in _ZN3std9panicking3$H37do_call$aL_ZN3std5panic16AssertUnwindSafe$aL_ZN12rustc_driver10closure_13$aL_ZN12rustc_driver10closure_25$aL_ZN12rustc_driver9closure_0$aR$aR$aR$C$T0$aR (arg0=0xf4e542bc "\260\330D\t") at output/rustc-build/librustc_driver.hir.o.c:194551
#31 0x084b165b in __rust_maybe_catch_panic ()
#32 0x085bdb22 in _ZN3std9panicking3try$aL$T0$C_ZN3std5panic16AssertUnwindSafe$aL_ZN12rustc_driver10closure_13$aL_ZN12rustc_driver10closure_25$aL_ZN12rustc_driver9closure_0$aR$aR$aR$aR (arg0=...) at output/rustc-build/librustc_driver.hir.o.c:194673
#33 _ZRK$aL_ZN3std11closure_I_3$aL_ZN3std6thread7Builder$C_ZN12rustc_driver10closure_13$aL_ZN12rustc_driver10closure_25$aL_ZN12rustc_driver9closure_0$aR$aR$C$T0$aR_as__ZN4core3ops6FnOnce$aL$T0$aR$aR9call_once (arg0=..., arg1=...) at output/rustc-build/librustc_driver.hir.o.c:18394
#34 _ZRK$aL_ZN3std11closure_I_3$aL_ZN3std6thread7Builder$C_ZN12rustc_driver10closure_13$aL_ZN12rustc_driver10closure_25$aL_ZN12rustc_driver9closure_0$aR$aR$C$T0$aR_as__ZN5alloc5boxed5FnBox$aL$T0$aR$aR8call_box (arg0=..., arg1=...) at output/rustc-build/librustc_driver.hir.o.c:18329
#35 0x08ef13aa in _ZN3std10sys_common6thread12start_thread ()
#36 0x08ef13dc in _ZN3std3sys3imp6thread3$H012thread_start ()
#37 0xf7ccafdb in start_thread () from /gnu/store/qk8irm5yp2khq4dj7zcpcaa1g87pfyvw-glibc-2.28/lib/libpthread.so.0
#38 0xf7ee85f6 in clone () from /gnu/store/qk8irm5yp2khq4dj7zcpcaa1g87pfyvw-glibc-2.28/lib/libc.so.6
(gdb) disassemble
Dump of assembler code for function _ZRK$aLf32_as__ZN4core3num7dec2flt5rawfp8RawFloat$aR8from_int:
   0x086626a0 <+0>:     sub    $0x2c,%esp
   0x086626a3 <+3>:     mov    0x34(%esp),%edx
   0x086626a7 <+7>:     mov    0x30(%esp),%eax
   0x086626ab <+11>:    mov    %edx,0x4(%esp)
   0x086626af <+15>:    mov    %eax,(%esp)
   0x086626b2 <+18>:    test   %edx,%edx
=> 0x086626b4 <+20>:    fildll (%esp)

(gdb) quit

(eax = 1, esp = 0xf4e46e50)

gcc 5.5.0 (native i686, not a cross compiler).

And on x86_64 with that mrustc-compiled rust we get SIGABRT:

Starting program: /tmp/guix-build-rust-1.19.0.drv-2/rustc-1.19.0-src/output/rustc-build/rustc -C linker=/gnu/store/ginrh3x6qi4w2i005gics37wzz5b78s7-gcc-5.5.0/bin/gcc -Z force-unstable-if-unmarked -L output/target-libs src/libcore/lib.rs -o output/target-libs/libcore.rlib
[...]
Thread 2 "rustc" received signal SIGABRT, Aborted.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007ffff515aca1 in __GI_abort () at abort.c:79
#2  0x0000000000c1c96d in _ZRI$aL_ZN4core6option6Option$aL_ZN6syntax4attr7IntType$aR$aR9unwrap_or (arg0=..., arg1=..., arg1@entry=...) at output/rustc-build/librustc.hir.o.c:1079847
#3  0x0000000000cca0e9 in _ZRI$aL_ZN5rustc2ty11ReprOptions$aR10discr_type (arg0=<optimized out>) at output/rustc-build/librustc.hir.o.c:1366137
#4  0x000000000125b511 in _ZN12rustc_typeck7collect26convert_enum_variant_types (arg0=..., arg1=..., arg1@entry=..., arg2=...) at output/rustc-build/librustc_typeck.hir.o.c:253174
#5  0x000000000125c56d in _ZN12rustc_typeck7collect12convert_item (arg0=..., arg1=...) at output/rustc-build/librustc_typeck.hir.o.c:253711
#6  0x0000000001338f9f in _ZRK$aL_ZN12rustc_typeck7collect23CollectItemTypesVisitor_as__ZN5rustc3hir10intravisit7Visitor$aR10visit_item (arg1=0x7fffd8387230, arg0=0x7ffff50d7c00) at output/rustc-build/librustc_typeck.hir.o.c:772061
#7  _ZRI$aL_ZN5rustc3hir5Crate$aR20visit_all_item_likes$aL_ZN5rustc3hir13itemlikevisit11DeepVisitor$aL_ZN12rustc_typeck7collect23CollectItemTypesVisitor$aR$aR (arg0=0x7ffff50de9c0, arg1=arg1@entry=0x7ffff50d7bf8) at output/rustc-build/librustc_typeck.hir.o.c:41664
#8  0x00000000013391de in _ZN12rustc_typeck7collect18collect_item_types (arg0=...) at output/rustc-build/librustc_typeck.hir.o.c:252570
#9  0x00000000013395a4 in _ZN5rustc4util6common4time$aL$T0$C_ZN12rustc_typeck9closure_1$aR (arg0=arg0@entry=false, arg1=..., arg2=..., arg2@entry=...) at output/rustc-build/librustc_typeck.hir.o.c:227940
#10 0x000000000134adb3 in _ZRI$aL_ZN5rustc7session7Session$aR12track_errors$aL_ZN12rustc_typeck9closure_2$C$T0$aR (arg1=..., arg0=0x7ffff50e2930) at output/rustc-build/librustc_typeck.hir.o.c:385157
#11 _ZN12rustc_typeck11check_crate (arg0=...) at output/rustc-build/librustc_typeck.hir.o.c:51389
#12 0x0000000000b229ea in _ZRK$aL_ZN12rustc_driver6driver10closure_22$aL_ZN12rustc_driver6driver10closure_49$C_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$aR_as__ZN4core3ops6FnOnce$aL$T1__ZN5rustc2ty7context6TyCtxt$aR$aR9call_once (arg0=..., arg1=...) at output/rustc-build/librustc_driver.hir.o.c:420724
#13 0x0000000000b29384 in _ZRK$aL_ZN5rustc2ty7context3tls9closure_2$aL_ZN12rustc_driver6driver10closure_22$aL_ZN12rustc_driver6driver10closure_49$C_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$aR$C_ZN4core6result6Result$aL_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$Cusize$aR$aR_as__ZN4core3ops6FnOnce$aL$T1_$Rs__ZN4core4cell4Cell$aL_ZN4core6option6Option$aL$T2_$Ss__ZN5rustc2ty7context3tls21ThreadLocalGlobalCtxt_$Ss__ZN5rustc2ty7context3tls20ThreadLocalInterners$aR$aR$aR$aR9call_once (arg1=..., arg0=...) at output/rustc-build/librustc_driver.hir.o.c:401585
#14 _ZRI$aL_ZN3std6thread5local8LocalKey$aL_ZN4core4cell4Cell$aL_ZN4core6option6Option$aL$T2_$Ss__ZN5rustc2ty7context3tls21ThreadLocalGlobalCtxt_$Ss__ZN5rustc2ty7context3tls20ThreadLocalInterners$aR$aR$aR$aR4with$aL_ZN5rustc2ty7context3tls9closure_2$aL_ZN12rustc_driver6driver10closure_22$aL_ZN12rustc_driver6driver10closure_49$C_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$aR$C_ZN4core6result6Result$aL_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$Cusize$aR$aR$C_ZN4core6result6Result$aL_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$Cusize$aR$aR (arg0=<optimized out>, arg1=...) at output/rustc-build/librustc_driver.hir.o.c:43944
#15 _ZN5rustc2ty7context3tls5enter$aL_ZN12rustc_driver6driver10closure_22$aL_ZN12rustc_driver6driver10closure_49$C_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$aR$C_ZN4core6result6Result$aL_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$Cusize$aR$aR (arg2=..., arg1=0x7ffff50dc2e8, arg0=0x7ffff50dc2e0) at output/rustc-build/librustc_driver.hir.o.c:30788
#16 _ZRK$aL_ZN5rustc2ty7context3tls9closure_1$aL_ZN12rustc_driver6driver10closure_22$aL_ZN12rustc_driver6driver10closure_49$C_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$aR$C_ZN4core6result6Result$aL_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$Cusize$aR$aR_as__ZN4core3ops6FnOnce$aL$T1_$Rs__ZN4core4cell4Cell$aLfn_2__ZN10syntax_pos4Span_$Ru__ZN4core3fmt9Formatter__ZN4core6result6Result$aL$T0$C_ZN4core3fmt5Error$aR$aR$aR$aR9call_once (arg1=..., arg0=...) at output/rustc-build/librustc_driver.hir.o.c:8178
#17 _ZRI$aL_ZN3std6thread5local8LocalKey$aL_ZN4core4cell4Cell$aLfn_2__ZN10syntax_pos4Span_$Ru__ZN4core3fmt9Formatter__ZN4core6result6Result$aL$T0$C_ZN4core3fmt5Error$aR$aR$aR$aR4with$aL_ZN5rustc2ty7context3tls9closure_1$aL_ZN12rustc_driver6driver10closure_22$aL_ZN12rustc_driver6driver10closure_49$C_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$aR$C_ZN4core6result6Result$aL_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$Cusize$aR$aR$C_ZN4core6result6Result$aL_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$Cusize$aR$aR (arg0=<optimized out>, arg1=...) at output/rustc-build/librustc_driver.hir.o.c:44195
#18 _ZRI$aL_ZN5rustc2ty7context6TyCtxt$aR16create_and_enter$aL_ZN12rustc_driver6driver10closure_22$aL_ZN12rustc_driver6driver10closure_49$C_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$aR$C_ZN4core6result6Result$aL_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$Cusize$aR$aR (arg12=..., arg11=..., arg10=..., arg9=..., arg8=..., arg7=..., arg6=..., arg5=0x7ffff50dad80, arg4=<optimized out>, arg3=..., arg2=..., arg1=..., arg0=<optimized out>) at output/rustc-build/librustc_driver.hir.o.c:64457
#19 _ZN12rustc_driver6driver27phase_3_run_analysis_passes$aL_ZN12rustc_driver6driver10closure_49$C_ZN4core6result6Result$aL$T2__ZN5rustc7session6config15OutputFilenames__ZN11rustc_trans16CrateTranslation$Cusize$aR$aR (arg0=0x7ffff50e2930, arg1=..., arg2=..., arg3=..., arg4=arg4@entry=0x7ffff50dde90, arg5=arg5@entry=0x7ffff50deaf0, arg6=..., arg7=...) at output/rustc-build/librustc_driver.hir.o.c:54337
#20 0x0000000000b2b463 in _ZN12rustc_driver6driver13compile_input (arg0=arg0@entry=0x7ffff50e2930, arg1=0x7ffff00014d0, arg2=arg2@entry=0x7ffff50e1760, arg3=arg3@entry=0x7ffff50e15b0, arg4=arg4@entry=0x7ffff50e15d0, arg5=..., arg6=arg6@entry=0x7ffff50e19f0) at output/rustc-build/librustc_driver.hir.o.c:182654
#21 0x0000000000b2c4ef in _ZN12rustc_driver12run_compiler (arg0=..., arg1=..., arg2=..., arg3=...) at output/rustc-build/librustc_driver.hir.o.c:190508
#22 0x0000000000b2caa5 in _ZRK$aL_ZN12rustc_driver9closure_0_as__ZN4core3ops2Fn$aL$T0$aR$aR4call (arg0=arg0@entry=0x7ffff50e8c8f, arg1=..., arg1@entry=...) at output/rustc-build/librustc_driver.hir.o.c:414596
#23 0x0000000000b2cb17 in _ZRK$aL_ZN12rustc_driver10closure_24$aL_ZN12rustc_driver9closure_0$aR_as__ZN4core3ops6FnOnce$aL$T0$aR$aR9call_once (arg0=..., arg1=..., arg1@entry=...) at output/rustc-build/librustc_driver.hir.o.c:416282
#24 0x0000000000b2ce30 in _ZRK$aL_ZN12rustc_driver9closure_3$aL_ZN12rustc_driver10closure_24$aL_ZN12rustc_driver9closure_0$aR$aR_as__ZN4core3ops6FnOnce$aL$T0$aR$aR9call_once (arg0=..., arg1=..., arg1@entry=...) at output/rustc-build/librustc_driver.hir.o.c:416518
#25 0x0000000000b2ce5e in _ZN3std9panicking3$H37do_call$aL_ZN3std5panic16AssertUnwindSafe$aL_ZN12rustc_driver9closure_3$aL_ZN12rustc_driver10closure_24$aL_ZN12rustc_driver9closure_0$aR$aR$aR$C$T0$aR (arg0=<optimized out>) at output/rustc-build/librustc_driver.hir.o.c:194483
#26 0x00000000006d14dc in __rust_maybe_catch_panic ()
#27 0x0000000000ac2a34 in _ZN3std9panicking3try$aL$T0$C_ZN3std5panic16AssertUnwindSafe$aL_ZN12rustc_driver9closure_3$aL_ZN12rustc_driver10closure_24$aL_ZN12rustc_driver9closure_0$aR$aR$aR$aR (arg0=...) at output/rustc-build/librustc_driver.hir.o.c:194605
#28 _ZRK$aL_ZN3std11closure_I_3$aL_ZN3std6thread7Builder$C_ZN12rustc_driver9closure_3$aL_ZN12rustc_driver10closure_24$aL_ZN12rustc_driver9closure_0$aR$aR$C$T0$aR_as__ZN4core3ops6FnOnce$aL$T0$aR$aR9call_once (arg0=..., arg1=...) at output/rustc-build/librustc_driver.hir.o.c:18030
#29 _ZRK$aL_ZN3std11closure_I_3$aL_ZN3std6thread7Builder$C_ZN12rustc_driver9closure_3$aL_ZN12rustc_driver10closure_24$aL_ZN12rustc_driver9closure_0$aR$aR$C$T0$aR_as__ZN5alloc5boxed5FnBox$aL$T0$aR$aR8call_box (arg0=..., arg1=...) at output/rustc-build/librustc_driver.hir.o.c:17965
#30 0x00000000005481ee in _ZN3std10sys_common6thread12start_thread ()
#31 0x0000000000548219 in _ZN3std3sys3imp6thread3$H012thread_start ()
#32 0x00007ffff7fa7019 in start_thread (arg=0x7ffff50ec700) at pthread_create.c:486
#33 0x00007ffff521792f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Valgrind reports a massive number of jumps depending on uninitialized values before the abort (they look spurious to me).

And sometimes this happens:

Program received signal SIGSEGV, Segmentation fault.
0xffffffffcd410750 in ?? ()
(gdb) bt
#0  0xffffffffcd410750 in ?? ()
#1  0x000000000052f050 in _ZN3std3sys3imp6memchr6memchr ()
#2  0x000000000052fc94 in _ZRI$aL_ZN3std3ffi5c_str7CString$aR4_new ()
#3  0x000000000052fd38 in _ZRI$aL_ZN3std3ffi5c_str7CString$aR3new$aL_ZN11collections6string6String$aR ()
#4  0x0000000000534da3 in _ZRK$aL_ZN3std11closure_I_6$aL_ZN3std6thread6Thread$aR_as__ZN4core3ops2Fn$aL$T1__ZN11collections6string6String$aR$aR4call ()
#5  0x000000000054b345 in _ZRI$aL_ZN3std6thread6Thread$aR3new ()
#6  0x000000000054fc9d in _ZN3std2rt10lang_start ()
#7  0x0000000000434fd4 in main (argc=<optimized out>, argv=<optimized out>) at output/rustc-build/rustc.c:91

However, compiling a.rs does work on x86_64.

This is on a stable release of the Guix distribution, 1.0.0, with standard compiler and everything.

If you would like, we can give you an account on a Guix machine. We take reproducible builds very seriously so it's quite easy to have exactly the dependencies one wants available and none other.

It's also possible (and supported) to install Guix on any other Linux distribution (https://ftp.gnu.org/gnu/guix/guix-binary-1.0.0.i686-linux.tar.xz - extract to /) and use it as a building and testing environment in parallel to using the original distribution (it takes a lot of disk space in operation, like 20 GB).

@thepowersgang
Copy link
Owner

That's more that I'd expect. There appears to be some form of floating-point bug somewhere, but due to the design of the x87 FPU it's very hard to tell where.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants