https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90539
--- Comment #20 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Thomas Koenig from comment #19)
> Thanks.
>
> A bit more:
>
> What are the declarations of the actual srgument,
> of the dummy argument (on the callee side),
> and what is the argument in the call list?
>
>
> Ill try to construct a test case tonight then.
So the callee is actually a C function:
;; Function nf_put_vara_double_ (null)
;; enabled by -tree-original
{
size_t B3[512];
size_t B4[512];
int A0;
# DEBUG BEGIN STMT;
size_t B3[512];
# DEBUG BEGIN STMT;
size_t B4[512];
# DEBUG BEGIN STMT;
int A0;
# DEBUG BEGIN STMT;
A0 = nc_put_vara_double (*fncid, *fvarid + -1, (const size_t *) f2c_coords
(*fncid, *fvarid + -1, (const int *) A3, (size_t *) &B3), (const size_t *)
f2c_counts (*fncid, *fvarid + -1, (const int *) A4, (size_t *) &B4), A5);
# DEBUG BEGIN STMT;
return A0;
}
where nc_put_vara_double is defined as:
int
nc_put_vara_double(int ncid, int varid,
const size_t *start, const size_t *edges, const double *value)
{
int status = NC_NOERR;
NC *ncp;
const NC_var *varp;
int ii;
size_t iocount;
status = NC_check_id(ncid, &ncp);
if(status != NC_NOERR)
return status;
if(NC_readonly(ncp))
return NC_EPERM;
if(NC_indef(ncp))
return NC_EINDEFINE;
varp = NC_lookupvar(ncp, varid);
if(varp == NULL)
return NC_ENOTVAR; /* TODO: lost NC_EGLOBAL */
if(varp->type == NC_CHAR)
return NC_ECHAR;
status = NCcoordck(ncp, varp, start);
if(status != NC_NOERR)
return status;
status = NCedgeck(ncp, varp, start, edges);
if(status != NC_NOERR)
return status;
if(varp->ndims == 0) /* scalar variable */
{
return( putNCv_double(ncp, varp, start, 1, value) );
}
if(IS_RECVAR(varp))
{
status = NCvnrecs(ncp, *start + *edges);
if(status != NC_NOERR)
return status;
if(varp->ndims == 1
&& ncp->recsize <= varp->len)
{
/* one dimensional && the only record variable */
return( putNCv_double(ncp, varp, start, *edges, value)
);
}
}
/*
* find max contiguous
* and accumulate max count for a single io operation
*/
ii = NCiocount(ncp, varp, edges, &iocount);
if(ii == -1)
{
return( putNCv_double(ncp, varp, start, iocount, value) );
}
assert(ii >= 0);
{ /* inline */
ALLOC_ONSTACK(coord, size_t, varp->ndims);
ALLOC_ONSTACK(upper, size_t, varp->ndims);
const size_t index = ii;
/* copy in starting indices */
(void) memcpy(coord, start, varp->ndims * sizeof(size_t));
/* set up in maximum indices */
set_upper(upper, start, edges, &upper[varp->ndims]);
/* ripple counter */
while(*coord < *upper)
{
const int lstatus = putNCv_double(ncp, varp, coord, iocount,
value);
if(lstatus != NC_NOERR)
{
if(lstatus != NC_ERANGE)
{
status = lstatus;
/* fatal for the loop */
break;
}
/* else NC_ERANGE, not fatal for the loop */
if(status == NC_NOERR)
status = lstatus;
}
value += iocount;
odo1(start, upper, coord, &upper[index], &coord[index]);
}
FREE_ONSTACK(upper);
FREE_ONSTACK(coord);
} /* end inline */
return status;
}
that calls: