bpo-29565: Fix compilation for C89 (GH-8626)

Use a local scope for the 'i' variable.
This commit is contained in:
Victor Stinner 2018-08-02 17:40:11 +02:00 committed by GitHub
parent 3243f8c1fb
commit 6a6b248347
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 8 deletions

View File

@ -220,14 +220,18 @@ ffi_call(/*@dependent@*/ ffi_cif *cif,
break;
#else
case FFI_SYSV:
/* If a single argument takes more than 8 bytes,
then a copy is passed by reference. */
for (unsigned i = 0; i < cif->nargs; i++) {
size_t z = cif->arg_types[i]->size;
if (z > 8) {
void *temp = alloca(z);
memcpy(temp, avalue[i], z);
avalue[i] = temp;
/* use a local scope for the 'i' variable */
{
unsigned i;
/* If a single argument takes more than 8 bytes,
then a copy is passed by reference. */
for (i = 0; i < cif->nargs; i++) {
size_t z = cif->arg_types[i]->size;
if (z > 8) {
void *temp = alloca(z);
memcpy(temp, avalue[i], z);
avalue[i] = temp;
}
}
}
/*@-usedef@*/