News:

Download Pelles C here: http://www.smorgasbordet.com/pellesc/

Main Menu

wrong line while debugging

Started by czerny, March 23, 2012, 09:43:16 PM

Previous topic - Next topic

czerny

Hallo!

Try the following two snippets!

The first one has a /* */ comment


#define UNICODE
#define _UNICODE

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>

/*
int __cdecl WinMainCRTStartup(void)
*/

int main(int argc, char **argv)
{
int i;
for (i=1;i<5;i++)
printf("%d\n",i);
return 0;
}


the second a // comment


#define UNICODE
#define _UNICODE

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>

//int __cdecl WinMainCRTStartup(void)

int main(int argc, char **argv)
{
int i;
for (i=1;i<5;i++)
printf("%d\n",i);
return 0;
}


while debugging the second example. The debugger is one line above the real position.
If I remove the line


#include <stdlib.h>


the problem is gone.

czerny

czerny

Can this be confirmed from anyone with 6.5 RC 4 32Bit? czerny

Bitbeisser

Quote from: czerny on March 24, 2012, 01:08:56 PM
Can this be confirmed from anyone with 6.5 RC 4 32Bit? czerny
Could you post your project settings for that test program?

Ralf

AlexN

Quote from: czerny on March 24, 2012, 01:08:56 PM
Can this be confirmed from anyone with 6.5 RC 4 32Bit? czerny
I haven't the time now to test it, but in the past the debugger of Pelles C had this problem - so I assume that this is another reason for this problem.
So we must wait for the next version of Pelles C and use a workaround still there.
best regards
Alex ;)

czerny

Quote
Could you post your project settings for that test program?
-Tx86-coff -Zi -Ob1 -fp:precise -W1 -Gd -Ze

TimoVJL

This have two lines offset
#define UNICODE
#define _UNICODE

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

//int __cdecl WinMainCRTStartup(void)

int main(int argc, char **argv)
{
int i;
for (i=1;i<5;i++)
printf("%d\n",i);
return 0;
}
May the source be with you

JohnF

For now, one can get around this problem by adjusting the order of the includes.


#include <windows.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>

int main(int argc, char **argv)
{
int i;
for (i=1;i<5;i++)
printf("%d\n",i);
return 0;
}


John

TimoVJL

Smaller example:
#include "foo.h"
#include "foo.h"
int main(int argc, char **argv)
{
int i = 1;
int j = 2;
return i+j;
}
foo.h#ifndef _FOO_H
#define _FOO_H
#pragma once // error if this line exist
#endif
May the source be with you

czerny

It seems, that this bug is not gone with 7.00.2 RC1.

czerny

czerny

Version: 7.00.348 Release Candidate #4

Step into the attached project until you reach the pictured (error.gif) point.

czerny

JohnF

The problem is with Optimizations which is a bug that has been reported several times.

John