Structs: Undefined variable in generated C code / -check t lacks shape factor info
The following program, when compiled with check -tc
, version 1.3.3-MijasCosta-1246-g5b3f4
use Structures: all except {zero, sel};
import Structures: {zero, sel};
use StdIO: all;
struct Body {
double x;
double y;
double z;
};
inline
struct Body add(struct Body a, struct Body b)
{
res = Body {a.x + b.x, a.y + b.y, a.z + b.z};
return res;
}
inline
struct Body acc(struct Body b1, struct Body b2, double m)
{
return add(b2, b1);
}
noinline
struct Body[B]
acc_v(struct Body[B] p1, struct Body[B] p2, double[B] ms)
{
return with {(. <= iv <= .): with {
([0] <= jv < [B]): acc(p1[iv], p2[jv], ms[jv]);
}: fold(add, zero(Body {0d, 0d, 0d}));
}: genarray([B], zero(Body {0d, 0d, 0d}));
}
noinline
struct Body[d:shp] id(struct Body[d:shp] x)
{
return x;
}
noinline
double[d:shp] id(double[d:shp] x)
{
return x;
}
int main()
{
n = 1000;
p1 = id(with {
}: genarray([n], zero( Body {0d, 0d, 0d})));
p2 = id(with {
}: genarray([n], zero( Body {0d, 0d, 0d})));
m = id(genarray([n], 1d));
p3 = acc_v(p1, p2, m);
return toi(p3[0].x);
}
complains about shape variables being undefined in SAC_ASSURE_TYPE_LINE
macro's. Variables like SAC_SACp_emal_6843__icc_2800_shpfac0
.