[all-commits] [llvm/llvm-project] d6acd0: [Sema] Fix crash when evaluating nested call with ...

Pierre van Houtryve via All-commits all-commits at lists.llvm.org
Thu Jan 5 23:58:03 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d6acd0196b3378bdeb5193053e290d7194c4f72d
      https://github.com/llvm/llvm-project/commit/d6acd0196b3378bdeb5193053e290d7194c4f72d
  Author: Pierre van Houtryve <pierre.vanhoutryve at amd.com>
  Date:   2023-01-06 (Fri, 06 Jan 2023)

  Changed paths:
    M clang/lib/AST/ExprConstant.cpp
    A clang/test/SemaCXX/enable_if-nested-call-with-valuedependent-param.cpp

  Log Message:
  -----------
  [Sema] Fix crash when evaluating nested call with value-dependent arg

Fix an edge case `ExprConstant.cpp`'s `EvaluateWithSubstitution` when called by `CheckEnableIf`

The assertion in `CallStackFrame::getTemporary`
could fail during evaluation of nested calls to a function
using `enable_if` when the second argument was a
value-dependent expression.

This caused a temporary to be created for the second
argument with a given version during the
evaluation of the inner call, but we bailed out
when evaluating the second argument of the
outer call due to the expression being value-dependent.
After bailing out, we tried to clean up the argument's value slot but it
caused an assertion to trigger in `getTemporary` as
a temporary for the second argument existed, but only for the inner call and not the outer call.

See the test case for a more complete description of the issue.

Reviewed By: ahatanak

Differential Revision: https://reviews.llvm.org/D139713




More information about the All-commits mailing list