[PATCH] D103825: [clang] Do not crash when ArgTy is null in CheckArgAlignment

Adam Czachorowski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 7 09:27:44 PDT 2021


adamcz created this revision.
adamcz requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

No repro case just yet. I only observed a crash like this and noticed
ArgTy-Value = 0 in coredump.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D103825

Files:
  clang/lib/Sema/SemaChecking.cpp


Index: clang/lib/Sema/SemaChecking.cpp
===================================================================
--- clang/lib/Sema/SemaChecking.cpp
+++ clang/lib/Sema/SemaChecking.cpp
@@ -4571,8 +4571,9 @@
 
   // Find expected alignment, and the actual alignment of the passed object.
   // getTypeAlignInChars requires complete types
-  if (ParamTy->isIncompleteType() || ArgTy->isIncompleteType() ||
-      ParamTy->isUndeducedType() || ArgTy->isUndeducedType())
+  if (ArgTy.isNull() || ParamTy->isIncompleteType() ||
+      ArgTy->isIncompleteType() || ParamTy->isUndeducedType() ||
+      ArgTy->isUndeducedType())
     return;
 
   CharUnits ParamAlign = Context.getTypeAlignInChars(ParamTy);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103825.350330.patch
Type: text/x-patch
Size: 695 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210607/6999c2ca/attachment.bin>


More information about the cfe-commits mailing list