[clang] [compiler-rt] [UBSAN] add null and alignment checks for aggregates (PR #164548)
Hubert Tong via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 22 21:17:20 PST 2025
hubert-reinterpretcast wrote:
> > However, how hard to pass it into EmitAggregateCopy? Maybe we can fork EmitAggregateCopy -> EmitAggregateCopyCurrentOne + EmitAggregateCopyWithSourceLocation and incrementally transition from first to another?
>
> The source location is not the only issue. As noted in [#164548 (comment)](https://github.com/llvm/llvm-project/pull/164548#discussion_r2529214150), if we use `EmitCheckedLValue` while we still have the source expression, we get better checking for array subscript operations.
@vitalybuka, ping.
IMO, adding checks in `EmitAggregateCopy` is too late. Adding calls to `EmitCheckedLValue` earlier in the AST processing that eventually calls `EmitAggregateCopy` is more comprehensive. A test-driven approach that identifies the AST processing paths for common cases strikes a good development cost/user benefit ratio. When further cases are identified, they can be addressed individually without a large upfront refactoring.
https://github.com/llvm/llvm-project/pull/164548
More information about the llvm-commits
mailing list