[CIR][NFC] Fix regression by #153819 (#154346)

This patch fixes a regression introduced by #153819. The evaluation
order of the arguments to `emitVAStart` is unspecified, but the test
requires the arguments to be evaluated in left-to-right order.

It's a bit strange that the pre-merge checks did not catch this. The
tests failed on my local machine, which runs Fedora 42 with gcc 15.2.1 .
This commit is contained in:
Sirui Mu 2025-08-19 23:32:02 +08:00 committed by GitHub
parent 6e3c7b8244
commit 10d193bf5e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -129,10 +129,11 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl &gd, unsigned builtinID,
case Builtin::BI__builtin_stdarg_start:
case Builtin::BI__builtin_va_start:
case Builtin::BI__va_start: {
emitVAStart(builtinID == Builtin::BI__va_start
mlir::Value vaList = builtinID == Builtin::BI__va_start
? emitScalarExpr(e->getArg(0))
: emitVAListRef(e->getArg(0)).getPointer(),
emitScalarExpr(e->getArg(1)));
: emitVAListRef(e->getArg(0)).getPointer();
mlir::Value count = emitScalarExpr(e->getArg(1));
emitVAStart(vaList, count);
return {};
}