Mail Archives: djgpp/1998/02/01/17:13:19
First the latter: I have sent a question regarding virtual memory when one of
my program crashed. I tried everything I was proposed. Then when nothing have
worked I have rewritten the code to first determine the total size I needed
then to allocate memory in 4096 bytes blocks till that amount in a second run.
The program is much slower, but works.
In this same program I have discovered a compiler error with -O3.
I have this little code in my program
....
fseek(fCC, sizeof(TFILEHEADER) +
newNewsRecord.lKeywords[i]*sizeof(TKEYRECORD), 0);
fread(&kr, sizeof(TKEYRECORD), 1, fCC);
while(kr.lParent)
{ /* get ordinal of record in ll */
ll = (kr.lParent - sizeof(TFILEHEADER)) / sizeof(TKEYRECORD) + 1;
if(ll >= lMin && ll < lMax)
SetBit(ll-lMin, l);
fseek(fCC, kr.lParent, 0);
fread(&kr, sizeof(TKEYRECORD), 1, fCC);
}
....
When compiled with -O3 the first fread() has never been executed: it was missing from
the code! Without -O3 it worked fine. I am using gcc 2.7.2.1.
So you have been warned...
Andras
- Raw text -