I think I've stumbled upon a serious bug in Pelles C (6.0 RC2).
The function below does not get fully compiled.
Everything between "if (!m_list_append(m_timers, timer))" and "return NULL" is completely missing from executable.
The fact that I cannot set breakpoint on those missing lines confirms this, it says "(Probably no executable code associated with this source line)".
I tried with all optimizations turned off - same result: after executing "m_list_append(m_timers, timer)" it jumps straight to "return NULL".
m_timer *m_timer_create(uint32_t period, m_timer_callback callback)
{
m_timer *timer;
if (!(timer = malloc(sizeof(m_timer))))
goto exit0;
if (!(timer->id = SetTimer(NULL, 0, period, &m_events_process_timer)))
goto exit1;
timer->callback = callback;
if (!m_list_append(m_timers, timer))
goto exit2;
return timer;
exit2:
KillTimer(NULL, timer->id);
exit1:
free(timer);
exit0:
return NULL;
}