[PATCH] D131979: [clang][UBSan] Fix __builtin_assume_aligned crash

Wang Yihan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 27 12:29:14 PDT 2022


yihanaa updated this revision to Diff 456140.
yihanaa added a comment.

Keep same behavior with current clang, don't emit an error when 1st arg is volatile qualified.

Ignore the implicit cast from user-written-type to 'const void *' on the 1st arg, because CodeGen need user-written-type to generate correct TypeDescriptor (this class in compiler-rt/UBSan), then, clang will emit cast instruction which cast type from user-written-type to VoidPtr in CodeGen.

But I still have some questions, for example: if someone pass a array type(e.g. char[1]) as the 1st arg, what should the correct TypeDescriptor? char[1] OR char *, clang will generate char * in this patch, you are experts and what do you all think?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131979/new/

https://reviews.llvm.org/D131979

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/test/Analysis/builtin-functions.cpp
  clang/test/CodeGen/builtin-assume-aligned.c
  clang/test/CodeGen/catch-alignment-assumption-array.c
  clang/test/CodeGen/catch-alignment-assumption-ignorelist.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131979.456140.patch
Type: text/x-patch
Size: 11665 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220827/b582d18b/attachment.bin>


More information about the cfe-commits mailing list