Hello,
I don't know if it is really a bug but I did not know where to post my problem.
Here is a simple example:
#include <stdio.h>
void test(void)
{
int i, j, a;
printf("Begin");
i = 1;
j = 8;
// for (a = 0; a < 10; a++);
a = 4;
_asm{
Boucle:
MOV eax, DWORD PTR [a]
DEC DWORD PTR [a]
JNZ Boucle
}
}
int main(void)
{
test();
return 0;
}
When I compile this example, I have the following warning:
Building main.obj.
D:\Utils\PellesC\Projects\Test\main.c(5): warning #2115: Local 'i' is initialized but never used.
D:\Utils\PellesC\Projects\Test\main.c(5): warning #2115: Local 'j' is initialized but never used.
D:\Utils\PellesC\Projects\Test\main.c(5): warning #2115: Local 'a' is initialized but never used.
Building Test.exe.
Done.
I already seen a similar message on the forum (with the function search) but my problem is a little bit different (see
http://smorgasbordet.com/phpBB2/viewtopic.php?t=830).
I know my example is rather stupid but I would like to understand why Pelles C does not initialize the variables which are declared initialzed correcly.
In fact, when you debug this piece of code, you can see that i, j and a variables are not initialized correctly with values defined in the code.
For example, the variable a is not equal to 4 but it has an unknow value.
Moreover, if you debug step by step the code, you could see Pelles C step over the line a = 4; :shock:
It simply ignore it.
Now, uncomment the line with for instruction and debug the piece of code.
The variable a is correctly initialized.
Is it normal?
Thanks and have a nice day.