Pelles C forum
Pelles C => Bug reports => Topic started by: lostcentaur on January 03, 2012, 12:41:35 AM
-
The following code in debugger mode - by stepping with F10 will jump from the first if statement right to the last statement while pC not being NULL.
(This code is part of a project ported from VS2005)
int CmmnHandleSelected(tsConsoleCtrl *pC,tsList *pL,HWND hWnd)
{
tsWndCtrl rWnd;
HWND hWndList;
if (pC == NULL)
{
pC = (tsConsoleCtrl *)GetWindowLongPtr(ghWndTBCombo,GWLP_USERDATA);
if (pC != NULL)
{
rWnd = pC->rWnd;
}
}
else
{
rWnd = pC->rWnd;
}
// Als beide lijsten leeg zijn, FALSE teruggeven
if ((pL == NULL) AND (rWnd.prRows == NULL)) return(0);
-
if PC is not NULL the next step in your program would be the final if statement... since debug is just tracing your code's execution, it makes sense it would jump past it...
-
No No, it does nothing with the first if then block !! not even the else tag, what I would expect him to do. It jumps to the next if, as if the first if-then-else block was completely ignored.
Now I did some further testing and it is clearly an optimisation bug for when I turned optimisation to 'none', the code runs fine - as should. The else part is used and a values was given for the variable.
-
No No, it does nothing with the first if then block !! not even the else tag, what I would expect him to do. It jumps to the next if, as if the first if-then-else block was completely ignored.
Now I did some further testing and it is clearly an optimisation bug for when I turned optimisation to 'none', the code runs fine - as should. The else part is used and a values was given for the variable.
Another optimizer bug... ouch. That's three now.
Sorry if I misunderstood.