Hello,
The small piece of code that follows is able to hang the optimizer, at least with my installation:
#define Round(_x)( ((_x) >= 0) ? ((_x) + 0.5f) : ((_x) - 0.5f) )
typedef struct
{
int n_row;
int n_col;
float *data;
} myType_t;
#define IMG_IN(_y,_x) image_in->data[(_y)*(image_in->n_col)+(_x)]
#define IMG_OUT(_y,_x) image_out->data[(_y)*(image_out->n_col)+(_x)]
void aSimpleFun ( myType_t *image_in,
myType_t *image_out
)
{
int x,y,i,j;
float r_fact,c_fact;
r_fact = 1.0f;
c_fact = 1.0f;
for( i=0; i<image_out->n_row; i++)
{
for(j=0; j<image_out->n_col; j++)
{
y = (int)Round(i*r_fact);
x = (int)Round(j*c_fact);
IMG_OUT(i,j) = IMG_IN(y,x);
}
}
}
When I compile with optimization level greater then 1, the optimizer never terminate (launched from CCS5) and when I look at my task list I can see that opt6x.exe is taking the 50% of CPU (the 100% of one core on my PC). If I change the macro Round and I use the math function roundf everything is Ok. The behaviour is not constant: in some compilation units I can use the same macro without problems (well, the original code that generate the problems is different: I have extracted a sample that trigger the same behaviour)
OS: Windows
Compiler: 7.2.4
CPU: C6678