Hello,

For the code (20020611-1.c)

int p;int k;unsigned int n;
void x ()
{

unsigned int h;                        //line 1
 h = n <= 30;                         //line 2 
// printf("%u\n",h);

  if (h)
    p = 1;
  else
    p = 0;

  if (h)
    k = 1;
  else
    k = 0;
}
unsigned int n = 30;

main ()
{
  x ();
  if (p != 1 || k != 1)
    abort ();
  exit (0);
}


By looking rtl dump generated with -dump-rtl-rnreg for code optimization Os, my 
target generates no code for line 1 and 2 .It generates code starting with 
checking CC value for if (h). For other optimization level, it generates proper 
code.

Again, if  a printf statement is added below line 2 (commented in above 
example), then even for Optimization Os it generates proper code.

1. Can anyone suggest the probable areas for this kind of behaviour.

2. What part of Optimzation level Os deals with removing redundant codes or is 
there a way to disable them?


Thanks in advance.

Regards,
Shafi.




Reply via email to