Skip to content

Commit e53e99f

Browse files
committed
Add UI test for __fastfail termination (0xc0000409) linker diagnostic note
1 parent 9ba0afd commit e53e99f

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

tests/ui/linking/auxiliary/link.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
// Dummy linker implementation simulating __fastfail termination
3+
// See <https://devblogs.microsoft.com/oldnewthing/20190108-00/?p=100655>
4+
fn main() {
5+
const STATUS_STACK_BUFFER_OVERRUN: i32 = 0xC0000409u32 as i32;
6+
std::process::exit(STATUS_STACK_BUFFER_OVERRUN);
7+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//@ build-fail
2+
//@ only-windows The abnormal behaviour may be observed only on Windows using the MSVC linker
3+
//@ only-msvc
4+
5+
//@ ignore-cross-compile because aux-bin does not yet support it
6+
//@ aux-bin: link.rs
7+
// Dummy linker that will always exit as if like with __fastfail abort()
8+
9+
//@ compile-flags: -Clinker={{build-base}}\linking\linker-fastfail-abort\auxiliary\bin\link.exe -Ctarget-feature=+crt-static
10+
11+
// Since the error notes are too verbose
12+
//@ dont-check-compiler-stderr
13+
//@ dont-require-annotations: NOTE
14+
15+
//~? ERROR linking with `$TEST_BUILD_DIR/auxiliary/bin/link.exe` failed: exit code: 0xc0000409
16+
//~? NOTE 0xc0000409 is `STATUS_STACK_BUFFER_OVERRUN`
17+
//~? NOTE This may occur when using the MSVC toolchain on Windows and can be caused by `__fastfail` termination, rather than necessarily indicating a stack buffer overrun.
18+
19+
fn main() {}

0 commit comments

Comments
 (0)