compile with gcc option -O0 or -O

zou wonder wonder.zou@gmail.com
Fri Sep 16 05:04:00 GMT 2011


HI guys:
 i am compiling codes with gcc4.4.4 :

but one weird problem is that the following codes compiled with option -O0

, then the logic could works well.

static BOOLE
tc_user_info_is_present
(
     VARIABLE_STR *var,
     VTASK        *task
)
{
   BOOLE result;

   if (mapIs_user_information(mapAsn)){
     result = 1;
   }
   else
   {
     result = 0;
   }
   return result;
}
but compiled with -O the codes could not work well.

but when i add some Trace in the code, compiled with -O , could also work well.


static BOOLE
tc_user_info_is_present
(
     VARIABLE_STR *var,
     VTASK        *task
)
{
   BOOLE result;

   if (mapIs_user_information(mapAsn)){
   XMM_ERROR("USER INFO SET");
     result = 1;
   }
   else
   {
    XMM_ERROR("USER INFO NOT SET");
     result = 0;
   }
   return result;
}

so my question is the what's the difference between the two options.

what's wrong with my program.

and the program is compiled in 64bit linux with -m32 option

thanks.



More information about the Gcc-help mailing list