A bit more info..
The problem only occurs when -O2 ( or higher) are used.
Replacing the following code
void DisplayEquipAt( char* sAddr)
{
int nDots = 0;
char *s;
for( s = sAddr; *s != '\0'; s ++) if( *s == '.') nDots ++;
.
.
.
}
With:
int CountDots( const char* sAddr)
{
int nDots = 0;
for( const char* s = sAddr; *s != '\0'; s ++) if( *s == '.') nDots ++;
return nDots;
}
void DisplayEquipAt( const char* sAddr)
{
int nAddrDots = CountDots( sAddr);
.
.
.
}
Sorry, I should have said that the code replacement above stops fault from occuring.
I've been trying to produce a simplyfied test case which exhibits the fault without any luck so far.
I observed that in the first snippet of code commenting out the "nDots ++;" stops the fault.
My assumption is that something about the earlier code in the module is somehow corrupting the "state" of CG.
> I've been trying to produce a simplyfied test case
> which exhibits the fault without any luck so far.
You can preprocess your source file with -E and send the output to us.
The other way is to debug cg with step-by-step instructions. Not sure you want to go that far.