]> git.lizzy.rs Git - rust.git/commitdiff
Make the backtrace-debuginfo test less error prone
authorBjörn Steinbrink <bsteinbr@gmail.com>
Mon, 10 Aug 2015 23:03:36 +0000 (01:03 +0200)
committerBjörn Steinbrink <bsteinbr@gmail.com>
Mon, 10 Aug 2015 23:18:45 +0000 (01:18 +0200)
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 #27619

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

index 8f41c68b0473fb4759d818e8a1460702f80a088b..f889e381dc46e17e6a644bef275cf0e72b0e3e7d 100644 (file)
@@ -8,7 +8,13 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags:-g
+// We disable tail merging here because it can't preserve debuginfo and thus
+// potentially breaks the backtraces. Also, subtle changes can decide whether
+// tail merging suceeds, so the test might work today but fail tomorrow due to a
+// seemingly completely unrelated change.
+// Unfortunately, LLVM has no "disable" option for this, so we have to set
+// "enable" to 0 instead.
+// compile-flags:-g -Cllvm-args=-enable-tail-merge=0
 // ignore-pretty as this critically relies on line numbers
 
 use std::io;
@@ -97,6 +103,10 @@ fn inner_further_inlined(counter: &mut i32, main_pos: Pos, outer_pos: Pos, inner
     let inner_pos = pos!(); aux::callback_inlined(|aux_pos| {
         check!(counter; main_pos, outer_pos, inner_pos, aux_pos);
     });
+
+    // this tests a distinction between two independent calls to the inlined function.
+    // (un)fortunately, LLVM somehow merges two consecutive such calls into one node.
+    inner_further_inlined(counter, main_pos, outer_pos, pos!());
 }
 
 #[inline(never)]