[clang] [clang] Fix crashes when passing VLA to va_arg (PR #119563)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 11 06:21:01 PST 2024
https://github.com/amane-ame created https://github.com/llvm/llvm-project/pull/119563
Closes #119360.
>From 659eda3ec76b63418f8b621b004728d9d7bf26ad Mon Sep 17 00:00:00 2001
From: amane-ame <i at amane-a.me>
Date: Wed, 11 Dec 2024 22:17:51 +0800
Subject: [PATCH] [clang] Fix crashes when passing VLA to va_arg
---
clang/lib/CodeGen/CGExprAgg.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp
index 2ad6587089f101..a4111cb65c8b1c 100644
--- a/clang/lib/CodeGen/CGExprAgg.cpp
+++ b/clang/lib/CodeGen/CGExprAgg.cpp
@@ -2201,6 +2201,8 @@ void CodeGenFunction::EmitAggregateCopy(LValue Dest, LValue Src, QualType Ty,
// But note that getTypeInfo returns 0 for a VLA.
if (auto *VAT = dyn_cast_or_null<VariableArrayType>(
getContext().getAsArrayType(Ty))) {
+ assert(Ty->isVariableArrayType());
+ EmitVariablyModifiedType(Ty);
QualType BaseEltTy;
SizeVal = emitArrayLength(VAT, BaseEltTy, DestPtr);
TypeInfo = getContext().getTypeInfoInChars(BaseEltTy);
More information about the cfe-commits
mailing list