[PATCH] D133583: [clang][ubsan] Fix __builtin_assume_aligned incorrect type descriptor and C++ object polymorphic address

Lin Yurong via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 16 13:16:08 PDT 2022


yronglin added a comment.

Thanks for your suggestion @aaron.ballman , also I have added a new test case for C++ polymorphism classes



================
Comment at: clang/test/Sema/builtin-redecl.cpp:5-6
 
+#include <stddef.h>
+
 // Redeclaring library builtins is OK.
----------------
aaron.ballman wrote:
> yronglin wrote:
> > aaron.ballman wrote:
> > > We can be tricky instead of including a header file.
> > Use `decltype` not works in C , can we use `typedef unsigned long size_t `instead? 
> Oh good catch, I had missed the `-x c` on a RUN line and was looking at the file extension alone. :-) We can't use that typedef because there are some platforms where that type is wrong, but we can be tricky in a different way: `typedef __typeof__(sizeof(0)) size_t;`
+1


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133583



More information about the cfe-commits mailing list