[PATCH] D100667: [clang] Fix assert() crash when checking undeduced arg alignment

Adam Czachorowski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 27 05:49:31 PDT 2021


adamcz added inline comments.


================
Comment at: clang/lib/Sema/SemaExpr.cpp:19668
     T = Context.DependentTy;
+  else if (const auto *U = T->getUnqualifiedDesugaredType())
+    if (U->isUndeducedType())
----------------
hokein wrote:
> I'm not sure we need this well. I think the above `T->isUndeducedType()` should be enough to fix all known crashes. I'd just remove this one.
It's enough to fix all known cases, but I'm a little worried that we'll be playing whack-a-mole with bugs like this forever. 

I think the fundamental problem is that a lot of functions have assumptions about state of their inputs and the flow is not sufficiently simple to be able to catch bugs like this in review. A little bit of defensive programming might be the best solution for the problem.
In this case, however, I'm not going to argue with you. Let's try this one more time. The updated fix is sufficient for all crashes we've seen so far.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100667



More information about the cfe-commits mailing list