Windows XP - Pelles C V7.00.350
This function gives an internal error: liveness_defsite() when optimization is enabled.
The error disappears when i comment out the line : idc.flags[ind] |= k;
or the line : idc.flags[ind] &= k;
//POCC test.c : => NO ERROR
//POCC -std:C11 -Tx86-coff -Ot -Ob1 -fp:precise -W1 -Gd test.c => internal error
#define false 0
#define true !false
typedef int bool;
#define FCT_FLAG_CLEAR 0
#define FCT_FLAG_SET 1
struct str_indic {
unsigned long flags[2]; //64 flags
};
struct str_indic idc;
bool SetResFlag(int i, int fct)
{
int j;
int k,ind;
bool f;
ind=0; if (i>=32) { ind=1; i-=32; }
k=1; for (j=0; j<i; j++) k<<=1;
f=false; if ((idc.flags[ind] & k)!=0) f=true;
if (fct==FCT_FLAG_SET) {
idc.flags[ind] |= k;
} else if (fct==FCT_FLAG_CLEAR) {
k=~k;
idc.flags[ind] &= k;
}
return f;
}
int main(void)
{
int i = 0;
SetResFlag(i, FCT_FLAG_SET);
return 0;
}