================
@@ -0,0 +1,107 @@
+// Tests the opt-in MSan local-uninitialized-read check
----------------
devsw-prayas wrote:

A test with the following snippets, compiled with `-fsanitize=memory 
-fsanitize-memory-local-address-never-taken`, gives this:

```c
int test_candidate(void) {
  int x;
  x;
  return 0;
}

int test_address_taken(void) {
  int y;
  int *p = &y;
  (void)p;
  y;
  return 0;
}
```

```llvm
; test_candidate:  x is a candidate, gets the metadata + check
%3 = load i32, ptr %x, align 4, !msan.check-uninit-read !2
...
%_mscmp = icmp ne i32 %_msld, 0
br i1 %_mscmp, label %7, label %8, !prof !3
7:
  call void @__msan_warning_noreturn() #6
  unreachable

; test_address_taken:  y's address is taken, excluded, no metadata
%13 = load i32, ptr %y, align 4
```

Is this the type of test that shd be added?


https://github.com/llvm/llvm-project/pull/207529
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to