Files
Michael Buch 59db71c7bd [lldb][test] Re-enable and fix TestUbsanBasic.py
UBSAN stopped reporting the misaligned load since 5569bf26f0 so this test started failing. We skipped it to unblock CI.

There's been discussion on making UBSAN stricter and still trigger on
the one-line version of this. But for now, to get the test running
again, change it to a form which *does* trigger UBSAN.

Fixes https://github.com/llvm/llvm-project/issues/177064
2026-01-22 09:28:47 +00:00

20 lines
330 B
C

int main() {
int data[4];
char *addr = &data[0];
int *ptr = addr + 2;
int result = *ptr; // align line
int *p = data + 5; // Index 5 out of bounds for type 'int [4]'
*p = data + 5;
*p = data + 5;
*p = data + 5;
*p = data + 5;
*p = data + 5;
*p = data + 5;
*p = data + 5;
*p = data + 5;
return 0;
}