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

rustc with LLVM 5 reports invalid DIExpression #47464

Closed
cuviper opened this issue Jan 15, 2018 · 1 comment
Closed

rustc with LLVM 5 reports invalid DIExpression #47464

cuviper opened this issue Jan 15, 2018 · 1 comment
Assignees
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@cuviper
Copy link
Member

cuviper commented Jan 15, 2018

This is a known problem from #43370, but I feel it deserves its own issue. When using rustc compiled with LLVM 5.0.1, compiling with debuginfo often prints "invalid expression" messages to stderr, and AFAICT affected functions don't get any debuginfo written at all. For example:

$ cat foo.rs
fn main() {
    (0..10).for_each(|i| println!("{}", i));
}

$ rustc -g foo.rs
invalid expression
!40 = !DIExpression(6, 34, 0)

Previous analysis in #43370 tied it to this declare_local call, and @eddyb offered a possible solution in #43370 (comment).

@cuviper cuviper mentioned this issue Jan 15, 2018
43 tasks
@cuviper cuviper self-assigned this Jan 20, 2018
@cuviper
Copy link
Member Author

cuviper commented Jan 20, 2018

LLVM <= 4.0 used a non-standard interpretation of DW_OP_plus (the 34 in that DIExpression). In the DWARF standard, this adds two items on the expressions stack. LLVM's behavior was more like DWARF's DW_OP_plus_uconst -- adding a constant that follows the op -- and the patch series starting with D33892 switched to the standard DWARF interpretation.

I'll work out the compatibility macros and send a PR soon.

kennytm added a commit to kennytm/rust that referenced this issue Jan 23, 2018
LLVM5: Update DW_OP_plus to DW_OP_plus_uconst

LLVM <= 4.0 used a non-standard interpretation of `DW_OP_plus`.  In the
DWARF standard, this adds two items on the expressions stack.  LLVM's
behavior was more like DWARF's `DW_OP_plus_uconst` -- adding a constant
that follows the op.  The patch series starting with [D33892] switched
to the standard DWARF interpretation, so we need to follow.

[D33892]: https://reviews.llvm.org/D33892

Fixes rust-lang#47464
r? @eddyb
@pietroalbini pietroalbini added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 23, 2018
raimue added a commit to raimue/macports-ports that referenced this issue Mar 27, 2018
The update to 1.24.0 in 4b2c24c erroneously switched to LLVM 5.0, which
is still not supported by this rust version. Compiling with rustc will
produce "invalid expression" messages.

See: rust-lang/rust#43370
See: rust-lang/rust#47464
g5pw pushed a commit to macports/macports-ports that referenced this issue Mar 28, 2018
The update to 1.24.0 in 4b2c24c erroneously switched to LLVM 5.0, which
is still not supported by this rust version. Compiling with rustc will
produce "invalid expression" messages.

See: rust-lang/rust#43370
See: rust-lang/rust#47464
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants