[PATCH] D133202: [Clang][CodeGen] Fix __builtin_assume_aligned crash

2022-09-02 Thread Lin Yurong via Phabricator via cfe-commits
yronglin created this revision. yronglin added a reviewer: rjmccall. Herald added a project: All. yronglin requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Clang will crash when __builtin_assume_aligned's 1st arg is array type(or string

[PATCH] D133202: [Clang][CodeGen] Fix __builtin_assume_aligned crash

2022-09-02 Thread Lin Yurong via Phabricator via cfe-commits
yronglin updated this revision to Diff 457580. yronglin added a comment. Format code Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D133202/new/ https://reviews.llvm.org/D133202 Files: clang/include/clang/Basic/Builtins.def

[PATCH] D133202: [Clang][CodeGen] Fix __builtin_assume_aligned crash

2022-09-02 Thread Lin Yurong via Phabricator via cfe-commits
yronglin added a comment. Hi John, I just have a new account, we continue here. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D133202/new/ https://reviews.llvm.org/D133202 ___ cfe-commits mailing list

[PATCH] D133202: [Clang][CodeGen] Avoid __builtin_assume_aligned crash when the 1st arg is array type

2022-09-03 Thread Lin Yurong via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG3ad2fe913ae0: [Clang][CodeGen] Avoid __builtin_assume_aligned crash when the 1st arg is array… (authored by yronglin). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D133202: [Clang][CodeGen] Avoid __builtin_assume_aligned crash when the 1st arg is array type

2022-09-06 Thread Lin Yurong via Phabricator via cfe-commits
yronglin added a comment. Thanks for your review @aaron.ballman , I've updated ReleaseNotes. I don’t have commit access, can you land this patch for me?Please use 'yronglin ' to commit the change. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D133202: [Clang][CodeGen] Avoid __builtin_assume_aligned crash when the 1st arg is array type

2022-09-06 Thread Lin Yurong via Phabricator via cfe-commits
yronglin updated this revision to Diff 458315. yronglin added a comment. Update ReleaseNotes Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D133202/new/ https://reviews.llvm.org/D133202 Files: clang/docs/ReleaseNotes.rst

[PATCH] D133202: [Clang] Avoid __builtin_assume_aligned crash when the 1st arg is array type

2022-09-07 Thread Lin Yurong via Phabricator via cfe-commits
yronglin updated this revision to Diff 458403. yronglin retitled this revision from "[Clang][CodeGen] Avoid __builtin_assume_aligned crash when the 1st arg is array type" to "[Clang] Avoid __builtin_assume_aligned crash when the 1st arg is array type". Repository: rG LLVM Github Monorepo

[PATCH] D133202: [Clang] Avoid __builtin_assume_aligned crash when the 1st arg is array type

2022-09-07 Thread Lin Yurong via Phabricator via cfe-commits
yronglin added a comment. In D133202#3774905 , @aaron.ballman wrote: > I've pushed the changes up for you, thanks! > > In D133202#3774801 , @yronglin > wrote: > >> ping~ > > Something to keep in mind for the

[PATCH] D133202: [Clang] Avoid __builtin_assume_aligned crash when the 1st arg is array type

2022-09-07 Thread Lin Yurong via Phabricator via cfe-commits
yronglin added a comment. ping~ Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D133202/new/ https://reviews.llvm.org/D133202 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D133202: [Clang][CodeGen] Avoid __builtin_assume_aligned crash when the 1st arg is array type

2022-09-05 Thread Lin Yurong via Phabricator via cfe-commits
yronglin updated this revision to Diff 458019. yronglin added a project: Sanitizers. yronglin added a comment. Fix windows build bolt broken https://lab.llvm.org/buildbot/#/builders/127/builds/35304 Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D133202: [Clang] Avoid __builtin_assume_aligned crash when the 1st arg is array type

2022-09-08 Thread Lin Yurong via Phabricator via cfe-commits
yronglin added a comment. Thanks a lot for your comments @rsmith @rjmccall . Firstly, as far as I know, turning on the `-fsanitizer=alignment` options when calling `__builtin_assume_aligned` in C code, Clang will emit `call void @__ubsan_handle_alignment_assumption(...)` in CodeGen, and

[PATCH] D133202: [Clang] Avoid __builtin_assume_aligned crash when the 1st arg is array type

2022-09-08 Thread Lin Yurong via Phabricator via cfe-commits
yronglin added inline comments. Comment at: clang/lib/Sema/SemaChecking.cpp:7651-7652 + Expr *FirstArg = TheCall->getArg(0); + if (auto *CE = dyn_cast(FirstArg)) +FirstArg = CE->getSubExprAsWritten(); rjmccall wrote: > rsmith wrote: > > This looks very

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

2022-09-09 Thread Lin Yurong via Phabricator via cfe-commits
yronglin updated this revision to Diff 459092. yronglin added a comment. format Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D133583/new/ https://reviews.llvm.org/D133583 Files: clang/include/clang/Basic/Builtins.def

[PATCH] D133202: [Clang] Avoid __builtin_assume_aligned crash when the 1st arg is array type

2022-09-09 Thread Lin Yurong via Phabricator via cfe-commits
yronglin added a comment. I've a new patch D133583 , please can you guys take a look Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D133202/new/ https://reviews.llvm.org/D133202

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

2022-09-09 Thread Lin Yurong via Phabricator via cfe-commits
yronglin added a comment. Hi, should I both fix alignment in this patch or in another separate patch? (this seems have different behavior with gcc https://godbolt.org/z/7dvM8zhnh ) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D133583/new/

[PATCH] D133202: [Clang] Avoid __builtin_assume_aligned crash when the 1st arg is array type

2022-09-08 Thread Lin Yurong via Phabricator via cfe-commits
yronglin added a comment. Seems that a builtin can't be redeclared which has custom type checking https://github.com/llvm/llvm-project/blob/ec8f2905a33ba970543c8edb4141c47f30d325f7/clang/lib/Basic/Builtins.cpp#L210-L214 Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D133202: [Clang] Avoid __builtin_assume_aligned crash when the 1st arg is array type

2022-09-08 Thread Lin Yurong via Phabricator via cfe-commits
yronglin added a comment. Reproduce windows broken test: ignore.cpp #include void *__builtin_assume_aligned(const void *, size_t, ...) noexcept; void foo() { int a; (void) __builtin_assume_aligned(, 4); } FunctionDecl 0x14a80e480 <./ignore.cpp:3:1, col:7> col:7

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

2022-09-09 Thread Lin Yurong via Phabricator via cfe-commits
yronglin created this revision. yronglin added reviewers: rjmccall, rsmith. Herald added a project: All. yronglin requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Fix __builtin_assume_aligned incorrect type descriptor example from @rsmith

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

2022-09-16 Thread Lin Yurong via Phabricator via cfe-commits
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 + // Redeclaring library builtins is OK. aaron.ballman wrote:

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

2022-09-16 Thread Lin Yurong via Phabricator via cfe-commits
yronglin updated this revision to Diff 460870. yronglin added a comment. Add test case for C++ polymorphism class Use `typedef __typeof__(sizeof(0)) size_t;` instead of `#include ` Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D133583/new/

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

2022-09-15 Thread Lin Yurong via Phabricator via cfe-commits
yronglin added a comment. In D133583#3792625 , @aaron.ballman wrote: > In D133583#3780460 , @yronglin > wrote: > >> Hi, follow D133202 , should I both fix >> alignment in

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

2022-09-20 Thread Lin Yurong via Phabricator via cfe-commits
yronglin added a comment. Thanks for take a review @aaron.ballman @rjmccall , can you land this patch for me? Please use 'yronglin ' to commit the change. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D133583/new/ https://reviews.llvm.org/D133583

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

2022-09-20 Thread Lin Yurong via Phabricator via cfe-commits
yronglin added a comment. In D133583#3803002 , @aaron.ballman wrote: > In D133583#3802451 , @yronglin > wrote: > >> Thanks for take a review @aaron.ballman @rjmccall , can you land this patch >> for me? Please

[PATCH] D133202: [Clang] Avoid __builtin_assume_aligned crash when the 1st arg is array type

2022-09-09 Thread Lin Yurong via Phabricator via cfe-commits
yronglin added a comment. Thanks very much for your comments @rjmccall @rsmith , I've take a look at D45383 , I believe that user code isn't allowed to declare __builtin_*, but seems `intrin0.inl.h` is a system header on windows, should we keep

[PATCH] D133202: [Clang][CodeGen] Avoid __builtin_assume_aligned crash when the 1st arg is array type

2022-09-02 Thread Lin Yurong via Phabricator via cfe-commits
yronglin updated this revision to Diff 457643. yronglin added a comment. Update patch with john's comments Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D133202/new/ https://reviews.llvm.org/D133202 Files: clang/include/clang/Basic/Builtins.def

[PATCH] D133202: [Clang][CodeGen] Avoid __builtin_assume_aligned crash when the 1st arg is array type

2022-09-02 Thread Lin Yurong via Phabricator via cfe-commits
yronglin added inline comments. Comment at: clang/lib/Sema/SemaChecking.cpp:7697 // The alignment must be a constant integer. - Expr *Arg = TheCall->getArg(1); + Expr *SecondArg = TheCall->getArg(1); rjmccall wrote: > This should be: > > ``` > Expr

[PATCH] D133202: [Clang][CodeGen] Avoid __builtin_assume_aligned crash when the 1st arg is array type

2022-09-02 Thread Lin Yurong via Phabricator via cfe-commits
yronglin added a comment. In D133202#3767414 , @rjmccall wrote: > Thanks, LGTM Thanks for your review John, but I don’t have commit access, can you land this patch for me? Please use "yronglin " to commit the change. Repository: rG LLVM Github

[PATCH] D133202: [Clang][CodeGen] Avoid __builtin_assume_aligned crash when the 1st arg is array type

2022-09-05 Thread Lin Yurong via Phabricator via cfe-commits
yronglin added a comment. In D133202#3768770 , @vitalybuka wrote: > Broken by the patch https://lab.llvm.org/buildbot/#/builders/127/builds/35304 Thanks @vitalybuka , seems `intrin0.inl.h` have a forward declaration `__MACHINE(void * __cdecl

[PATCH] D138137: [CodeGen][ARM] Fix ARMABIInfo::EmitVAAarg crash with empty record type variadic arg

2022-11-16 Thread Lin Yurong via Phabricator via cfe-commits
yronglin created this revision. yronglin added reviewers: rjmccall, asl. Herald added a subscriber: kristof.beyls. Herald added a project: All. yronglin requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Fix ARMABIInfo::EmitVAAarg crash with

[PATCH] D138137: [CodeGen][ARM] Fix ARMABIInfo::EmitVAAarg crash with empty record type variadic arg

2022-11-18 Thread Lin Yurong via Phabricator via cfe-commits
yronglin added a comment. Thank you so much for your review, @rjmccall , can you land this patch for me? Please use 'yronglin ' to commit the change. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D138137/new/ https://reviews.llvm.org/D138137

[PATCH] D138137: [CodeGen][ARM] Fix ARMABIInfo::EmitVAAarg crash with empty record type variadic arg

2022-11-18 Thread Lin Yurong via Phabricator via cfe-commits
yronglin added a comment. Thank you so much for your review, @rjmccall Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D138137/new/ https://reviews.llvm.org/D138137 ___ cfe-commits mailing list

[PATCH] D138137: [CodeGen][ARM] Fix ARMABIInfo::EmitVAAarg crash with empty record type variadic arg

2022-11-17 Thread Lin Yurong via Phabricator via cfe-commits
yronglin updated this revision to Diff 476093. yronglin added a comment. Fix test Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D138137/new/ https://reviews.llvm.org/D138137 Files: clang/lib/CodeGen/TargetInfo.cpp