Issue 177682
Summary [Clang][CodeGen] UBSan fails to detect misaligned memory access after PR152575
Labels clang:codegen, compiler-rt:ubsan, regression
Assignees dtcxzyw
Reporter dtcxzyw
    With https://github.com/llvm/llvm-project/pull/152575, the pointer alignment of a subscript _expression_ gets refined based on the constant indices. It may cause a smaller alignment than the natural one. Now ubsan no longer detects misaligned memory access in some cases. We want to make ubsan stricter to restore the previous behavior.

Reproducers (credits to @vitalybuka):
before: https://godbolt.org/z/E1rG51cc1
after: https://godbolt.org/z/rj47nMbno
gcc: https://godbolt.org/z/hxbaPhTrM

See also https://github.com/llvm/llvm-project/pull/152575#issuecomment-3649041011 and https://github.com/llvm/llvm-project/issues/177064 for previous discussions.

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to