Skip to content

Commit

Permalink
fix the naked-asan test
Browse files Browse the repository at this point in the history
we get these declarations

```
; opt level 0
declare x86_intrcc void @page_fault_handler(ptr byval([8 x i8]) align 8, i64) unnamed_addr #1
; opt level > 0
declare x86_intrcc void @page_fault_handler(ptr noalias nocapture noundef byval([8 x i8]) align 8 dereferenceable(8), i64 noundef) unnamed_addr #1
```

The space after `i64` in the original regex made the regex not match for
opt level 0. Removing the space fixes the issue.

```
declare x86_intrcc void @page_fault_handler(ptr {{.*}}, i64 {{.*}}){{.*}}#[[ATTRS:[0-9]+]]
```
  • Loading branch information
folkertdev committed Dec 1, 2024
1 parent cf738f6 commit a8f8c65
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions tests/codegen/naked-asan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@ pub fn caller() {
page_fault_handler(1, 2);
}

// CHECK: declare x86_intrcc void @page_fault_handler(ptr {{.*}}, i64 {{.*}}){{.*}}#[[ATTRS:[0-9]+]]
// CHECK: declare x86_intrcc void @page_fault_handler(ptr {{.*}}, i64{{.*}}){{.*}}#[[ATTRS:[0-9]+]]
// CHECK-NOT: memcpy
#[naked]
#[no_mangle]
pub extern "x86-interrupt" fn page_fault_handler(_: u64, _: u64) {
unsafe {
core::arch::naked_asm!("ud2");
}
unsafe { core::arch::naked_asm!("ud2") };
}

// CHECK: #[[ATTRS]] =
Expand Down

0 comments on commit a8f8c65

Please sign in to comment.