You just need to disable Optimization under code generation.
Yes I'm on Win 11 22H2 and Pelles C V12.00.2
Works fine then.
John Z
Update:
Level 2 warnings show 2 places with "Dead code removed (around here)." ...
these are both on macro statement
ListView_GetSubItemRect(pCustomDraw->nmcd.hdr.hwndFrom, pCustomDraw->nmcd.dwItemSpec, pCustomDraw->iSubItem, LVIR_BOUNDS, &rcBar);
which invokes
(BOOL)SNDMSG((hwnd),LVM_GETSUBITEMRECT,(WPARAM)(int)(iItem),((prc)?((((LPRECT)(prc))->top = iSubItem),(((LPRECT)(prc))->left = code),(LPARAM)(prc)):(LPARAM)(LPRECT)NULL))
I suspect optimizer might be having issues with (prc)? parameter 3 ... but this is just a guess. To test the (prc)? parameter could be broken out into one line which then precedes a standard SendMessage statement with the parameters rather than the macro.