gen while loop translation error
This gen code // find first free index
index = 0;
n = dim(index_to_id);
while (index < n && peek(index_to_id, index) >= 0)
{ // slot not empty
index += 1;
}
is wrongly translated like this
int index = ((int)0);
int index_to_id_dim = m_index_to_id_1.dim;
int index_to_id_channels = m_index_to_id_1.channels;
int n = index_to_id_dim;
bool index_ignore_12 = ((index >= index_to_id_dim) || (index < 0));
// samples index_to_id channel 1;
int chan_13 = ((int)0);
bool chan_ignore_14 = ((chan_13 < 0) || (chan_13 >= index_to_id_channels));
t_sample peek_532 = ((chan_ignore_14 || index_ignore_12) ? 0 : m_index_to_id_1.read(index, chan_13));
t_sample peek_533 = index;
while (((index < n) && (peek_532 >= ((int)0)))) {
// abort processing if an infinite loop is suspected;
if (((__loopcount--) <= 0)) {
__exception = GENLIB_ERR_LOOP_OVERFLOW;
break ;
};
index = (index + ((int)1));
};
where the peek_532 in the while condition is NOT updated in the loop.
This looks like gen is having a hard time inferring whether or not index or other variables are updated at signal rate, perhaps related to the way you are updating it within your subroutines discussed on this other post