Skip to content

Commit 689d13d

Browse files
committed
Make the backtrace-debuginfo test less error prone
LLVM might perform tail merging on the calls that initiate the unwinding process which breaks debuginfo and therefore this test. Since tail merging is guaranteed to break debuginfo, it should be disabled for this test. This allows us to restore a testcase that I had to remove earlier because of the same problem, because back then I didn't realize that disabling tail merging was an option. cc rust-lang#27619
1 parent 8856927 commit 689d13d

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/test/run-pass/backtrace-debuginfo.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,13 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// compile-flags:-g
11+
// We disable tail merging here because it can't preserve debuginfo and thus
12+
// potentially breaks the backtraces. Also, subtle changes can decide whether
13+
// tail merging suceeds, so the test might work today but fail tomorrow due to a
14+
// seemingly completely unrelated change.
15+
// Unfortunately, LLVM has no "disable" option for this, so we have to set
16+
// "enable" to 0 instead.
17+
// compile-flags:-g -Cllvm-args=-enable-tail-merge=0
1218
// ignore-pretty as this critically relies on line numbers
1319

1420
use std::io;
@@ -97,6 +103,10 @@ fn inner_inlined(counter: &mut i32, main_pos: Pos, outer_pos: Pos) {
97103
let inner_pos = pos!(); aux::callback_inlined(|aux_pos| {
98104
check!(counter; main_pos, outer_pos, inner_pos, aux_pos);
99105
});
106+
107+
// this tests a distinction between two independent calls to the inlined function.
108+
// (un)fortunately, LLVM somehow merges two consecutive such calls into one node.
109+
inner_further_inlined(counter, main_pos, outer_pos, pos!());
100110
}
101111

102112
#[inline(never)]

0 commit comments

Comments
 (0)