[Bug 1153314] New: incorrect debug info generated by rustc due to using somewhat older version of llvm
http://bugzilla.suse.com/show_bug.cgi?id=1153314 Bug ID: 1153314 Summary: incorrect debug info generated by rustc due to using somewhat older version of llvm Classification: openSUSE Product: openSUSE Distribution Version: Leap 15.1 Hardware: Other OS: Other Status: NEW Severity: Normal Priority: P5 - None Component: Development Assignee: bnc-team-screening@forge.provo.novell.com Reporter: tdevries@suse.com QA Contact: qa-bugs@suse.de Found By: --- Blocker: --- [ Regression due to upgrade from rustc version 1.32.0 to 1.36.0 ] On my openSUSE Leap 15.1 laptop I build gdb and ran the gdb testsuite, and ran into a failure in the gdb.rust testsuite (https://sourceware.org/bugzilla/show_bug.cgi?id=25048). The situation on the distro is that (summarizing Tom Tromey's comment here) with a relatively recent version of Rust but a somewhat older version of LLVM, the Rust compiler will emit a legacy encoding of enums. The problem is that there's a bug in the resulting debug info that makes gdb print incorrect values or "<error reading variable>". We could get this fixed in the rust compiler, either upstream or locally if upstream's not interested (which is what Tom Tromy expects), or perhaps make rustc work with a more recent version of LLVM. On openSUSE 15.1, we have rustc version 1.36.0 using llvm 7. On openSUSE tumbleweed (installed in a VM), we have rustc version 1.37.0 and llvm 8, and there there's no failure. I tried installing the rustc from devel:languages:rust, and got rustc version 1.38.0 and llvm 7, and the failure was still there. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.suse.com/show_bug.cgi?id=1153314
Tom de Vries
http://bugzilla.suse.com/show_bug.cgi?id=1153314
http://bugzilla.suse.com/show_bug.cgi?id=1153314#c1
--- Comment #1 from Tom de Vries
The problem is that there's a bug in the resulting debug info that makes gdb print incorrect values or "<error reading variable>".
We could get this fixed in the rust compiler, either upstream or locally if upstream's not interested (which is what Tom Tromy expects),
Filed upstream PR https://github.com/rust-lang/rust/issues/65204 -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.suse.com/show_bug.cgi?id=1153314
http://bugzilla.suse.com/show_bug.cgi?id=1153314#c2
--- Comment #2 from Federico Mena Quintero
http://bugzilla.suse.com/show_bug.cgi?id=1153314
http://bugzilla.suse.com/show_bug.cgi?id=1153314#c3
--- Comment #3 from Tom de Vries
So... the failure is with the LLVM7 included in rustc?
AFAIU, in all cases I looked at, the system LLVM is used. [ FWIW, the version bundled with the 1.32.0 tarball in openSUSE:Leap:15.1:rust is already LLVM8. ]
And it works when we use the system's LLVM8?
I dug a bit further, and found the following code change: ... $ git diff 1.32.0 1.33.0 -- librustc_codegen_llvm/debuginfo/metadata.rs @@ -1173,7 +1164,10 @@ fn use_enum_fallback(cx: &CodegenCx) -> bool { // On MSVC we have to use the fallback mode, because LLVM doesn't // lower variant parts to PDB. return cx.sess().target.target.options.is_like_msvc - || llvm_util::get_major_version() < 7; + // LLVM version 7 did not release with an important bug fix; + // but the required patch is in the LLVM 8. Rust LLVM reports + // 8 as well. + || llvm_util::get_major_version() < 8; } // Describes the members of an enum value: An enum is described as a union of ... So, we have: 1. openSUSE Leap 15.1 without update repository: - rustc version 1.32.0 - system llvm 7 2. openSUSE Leap 15.1 with update repository: - rustc version 1.36.0 - system llvm 7 3. openSUSE Tumbleweed: - rustc version 1.37.0 - system llvm 8 In case 1, use_enum_fallback returns false, because llvm version is 7 (required to be at least 7 to avoid fallback). So the fallback is not used, the compiler generates a DW_TAG_variant description of the enum, and the correct value is printed. In case 2, use_enum_fallback returns true, because llvm version is 7 (required to be at least 8 to avoid fallback). So the fallback is used, the compiler generates a legacy description of the enum, which contains a bug, and the incorrect value is printed. In case 3, use_enum_fallback returns true, because llvm version is 8 (required to be at least 8 to avoid fallback). So the fallback is not used, and things are back to how they were at case 1. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.suse.com/show_bug.cgi?id=1153314
http://bugzilla.suse.com/show_bug.cgi?id=1153314#c4
--- Comment #4 from Tom de Vries
In case 3, use_enum_fallback returns true, because llvm version is 8 (required to be at least 8 to avoid fallback).
Sorry, that should obviously be: ... In case 3, use_enum_fallback returns false, because llvm version is 8 (required to be at least 8 to avoid fallback). ... -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.suse.com/show_bug.cgi?id=1153314
http://bugzilla.suse.com/show_bug.cgi?id=1153314#c5
--- Comment #5 from Tom de Vries
http://bugzilla.suse.com/show_bug.cgi?id=1153314
Alynx Zhou
http://bugzilla.suse.com/show_bug.cgi?id=1153314
http://bugzilla.suse.com/show_bug.cgi?id=1153314#c6
Richard Biener
So the fallback is used, the compiler generates a legacy description of the enum, which contains a bug, and the incorrect value is printed.
Is "the compiler" the rust compiler? If so then fix it. LLVM is not a supported compiler (but only the engine Mesa happens to use). -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.suse.com/show_bug.cgi?id=1153314
http://bugzilla.suse.com/show_bug.cgi?id=1153314#c7
--- Comment #7 from Tom de Vries
So the fallback is used, the compiler generates a legacy description of the enum, which contains a bug, and the incorrect value is printed.
Is "the compiler" the rust compiler?
Yes.
If so then fix it. LLVM is not a supported compiler (but only the engine Mesa happens to use).
Right, that, or have rustc use the bundled llvm. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.suse.com/show_bug.cgi?id=1153314
http://bugzilla.suse.com/show_bug.cgi?id=1153314#c8
--- Comment #8 from Richard Biener
(In reply to Richard Biener from comment #6)
So the fallback is used, the compiler generates a legacy description of the enum, which contains a bug, and the incorrect value is printed.
Is "the compiler" the rust compiler?
Yes.
If so then fix it. LLVM is not a supported compiler (but only the engine Mesa happens to use).
Right, that, or have rustc use the bundled llvm.
That sounds even better (for both maint of rust and "our" copy of llvm). -- You are receiving this mail because: You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@novell.com