efriedma-quic wrote: Please add a testcase to clang/test/CodeGen/ . Put it in an existing file if there's already some related test. (See also https://llvm.org/docs/Contributing.html#how-to-submit-a-patch )
I don't think EmitAggregateCopy is the right place to call EmitVariablyModifiedType: we want to call EmitVariablyModifiedType exactly once for every VLA written in the source code. So the call should be located somewhere that's tightly related to the expression itself: CodeGenFunction::EmitVAArg, or something like that. While you're here, maybe look at emitting an undefined-behavior warning for this construct? A VLA is never compatible with a function argument: if you try to write an array in an function type, it gets promoted to a pointer. So this construct is guaranteed to produce broken results (which is why nobody has tripped over this before). https://github.com/llvm/llvm-project/pull/119563 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits