[clang] [clang] Fix high memory consumption during pack deduction (PR #88637)

Matheus Izvekov via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 14 10:13:44 PDT 2024


================
@@ -831,7 +831,7 @@ class PackDeductionScope {
     if (IsPartiallyExpanded)
       PackElements += NumPartialPackArgs;
     else if (IsExpanded)
-      PackElements += *FixedNumExpansions;
+      PackElements += FixedNumExpansions.value_or(1);
----------------
mizvekov wrote:

The assert is not necessary, unless it added explanation.
The `*` operator on the optional here should already assert in that case.

I would advise you run this test case on an llvm build with runtime checks enabled. The compiler is going off the rails before this point, so maybe there is an earlier assert that could narrow it down.

Otherwise, the change lacks explanation, about what is the problem, and what the fix does.

https://github.com/llvm/llvm-project/pull/88637


More information about the cfe-commits mailing list