[Bug tree-optimization/21513] [4.0/4.1 Regression] __builtin_expect getting in the way of uninitialized warnings

alexander_herrmann at yahoo dot com dot au gcc-bugzilla@gcc.gnu.org
Tue Nov 1 10:46:00 GMT 2005



------- Comment #4 from alexander_herrmann at yahoo dot com dot au  2005-11-01 10:46 -------
Subject: Re:  [4.0/4.1 Regression] __builtin_expect getting in the way of
uninitialized warnings

Never is a long time. It may become release relevant
as soon as somebody extends the 
-Wunused-value the way other today compiler handle it
like warning me about a value wich is assigned to a
local variable without beeing used.
Sp please consider the workaround code fragment:

int problem_funktion(int a)
{
   int b = 0; // WORKAROUND
   if (__builtin_expect(((a > 0) && ((b = 5) != 0)),
1))
   {
      return(a*b);
   }
   return(a);
} 

Compiled with gcc -Wall -O it produces the no wrong
Warning. As a Value is assigned to b.
I did this quite often as a workaround
http://www.aiengine.org/doc/index.html . But if
somebody whithin the time of never does spend the time
to extend the -Wunused-value the way it works in other
up2date compilers gcc will complain based on the
data-flow analyses that b is assigned the value of 0
which is never used. Imo this can become reality
before never comes which would prevent these code in
any case to be compiled. Doesn't have to P2 but
something higher than P5 would be appriciated so that
somebody may take the time to look into it bevor never
is here. 


Send instant messages to your online friends http://uk.messenger.yahoo.com 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21513



More information about the Gcc-bugs mailing list