From dd48e56b7705f6931dd89e75a78c7697e1cf9250 Mon Sep 17 00:00:00 2001 From: Martin Nordholts Date: Wed, 16 Jul 2025 19:42:23 +0200 Subject: [PATCH 1/2] tests: Test line number in debuginfo for diverging function calls --- .../diverging-function-call-debuginfo.rs | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tests/codegen/diverging-function-call-debuginfo.rs diff --git a/tests/codegen/diverging-function-call-debuginfo.rs b/tests/codegen/diverging-function-call-debuginfo.rs new file mode 100644 index 0000000000000..49a5b2fffa8e9 --- /dev/null +++ b/tests/codegen/diverging-function-call-debuginfo.rs @@ -0,0 +1,33 @@ +/// Make sure that line debuginfo is correct for diverging calls under certain +/// conditions. In particular we want to ensure that the line number is never +/// 0, but we check the absence of 0 by looking for the expected exact line +/// numbers. Regression test for . + +//@ compile-flags: -g -Clto -Copt-level=0 +//@ no-prefer-dynamic + +fn main() { + if True == False { + // unreachable + // CHECK-DAG: [[UNREACHABLE_CALL_DBG:![0-9]+]] = !DILocation(line: [[@LINE+1]], column: 9, scope: + diverge(); + } + + // CHECK-DAG: [[LAST_CALL_DBG:![0-9]+]] = !DILocation(line: [[@LINE+1]], column: 5, scope: + diverge(); +} + +#[derive(PartialEq)] +pub enum MyBool { + True, + False, +} + +use MyBool::*; + +fn diverge() -> ! { + panic!(); +} + +// CHECK-DAG: call void {{.*}}diverging_function_call_debuginfo{{.*}}diverge{{.*}} !dbg [[LAST_CALL_DBG]] +// CHECK-DAG: call void {{.*}}diverging_function_call_debuginfo{{.*}}diverge{{.*}} !dbg [[UNREACHABLE_CALL_DBG]] From 72f260dad4687f7d345c1ec51980c7909a68cdc8 Mon Sep 17 00:00:00 2001 From: Martin Nordholts Date: Sat, 19 Jul 2025 10:13:46 +0200 Subject: [PATCH 2/2] TEMP: debug Windows .ll with bigger FileCheck input context --- src/tools/compiletest/src/runtest.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 933a32392bddf..e19dc67c49542 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -2050,7 +2050,7 @@ impl<'test> TestCx<'test> { filecheck.arg("--allow-unused-prefixes"); // Provide more context on failures. - filecheck.args(&["--dump-input-context", "100"]); + filecheck.args(&["--dump-input-context", "1000000"]); // Add custom flags supplied by the `filecheck-flags:` test directive. filecheck.args(&self.props.filecheck_flags);