1
0
Fork 0
mirror of https://github.com/ganelson/inform.git synced 2024-06-29 05:24:57 +03:00

Initialize kinds array

GCC warns that ka[1] is possibly being used without being initialized. As
far as I can tell from reading the loop, a1 > 0 here, and the elements of
ka are initialized up to a1-1, and ka[1] is never accessed if a1 == 1.

Nonetheless, rather than rewriting the loop so GCC can understand what's
going on, maybe it's better just to put an initializer here.
This commit is contained in:
Philip Chimento 2022-04-10 19:10:23 -07:00
parent 50d39679e9
commit c029af34ae

View file

@ -147,7 +147,7 @@ kind *Latticework::j_or_m(kind *K1, kind *K2, int direction) {
int a2 = KindConstructors::arity(K2->construct);
if ((a1 > 0) || (a2 > 0)) {
if (K2->construct != con) return K_value;
kind *ka[MAX_KIND_CONSTRUCTION_ARITY];
kind *ka[MAX_KIND_CONSTRUCTION_ARITY] = { NULL, };
for (int i=0; i<a1; i++)
if (con->variance[i] == COVARIANT)
ka[i] = Latticework::j_or_m(K1->kc_args[i], K2->kc_args[i], direction);