[PATCH] D85601: Fixes an assertion when IntRange processes a throw expression

Mark de Wever via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 14 10:28:37 PDT 2020


Mordante marked 3 inline comments as done.
Mordante added inline comments.


================
Comment at: clang/lib/Sema/SemaChecking.cpp:10317-10320
     IntRange L =
         GetExprRange(C, CO->getTrueExpr(), MaxWidth, InConstantContext);
     IntRange R =
         GetExprRange(C, CO->getFalseExpr(), MaxWidth, InConstantContext);
----------------
rsmith wrote:
> It seems to me that the bug is here. `GetExprRange` is documented as "Pseudo-evaluate the given **integer** expression", but the true and false expressions here might not be integer expressions -- specifically, one of them could be of type `void` if it's a //throw-expression//. In that case, we should only call `GetExprRange` on the other expression. The expression range of the `void`-typed expression is irrelevant in this case, because that expression never returns.
Thanks for the hint I'll look into this solution.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85601



More information about the cfe-commits mailing list