public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/21513] [4.0/4.1 Regression] __builtin_expect getting in the way of uninitialized warnings
       [not found] <bug-21513-10614@http.gcc.gnu.org/bugzilla/>
@ 2005-10-13  1:48 ` pinskia at gcc dot gnu dot org
  2005-10-31  3:31 ` mmitchel at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-13  1:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2005-10-13 01:48 -------
Just a note, I don't think this can be done without removing loop.c


-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug tree-optimization/21513] [4.0/4.1 Regression] __builtin_expect getting in the way of uninitialized warnings
       [not found] <bug-21513-10614@http.gcc.gnu.org/bugzilla/>
  2005-10-13  1:48 ` [Bug tree-optimization/21513] [4.0/4.1 Regression] __builtin_expect getting in the way of uninitialized warnings pinskia at gcc dot gnu dot org
@ 2005-10-31  3:31 ` mmitchel at gcc dot gnu dot org
  2005-11-01 10:46 ` alexander_herrmann at yahoo dot com dot au
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-10-31  3:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from mmitchel at gcc dot gnu dot org  2005-10-31 03:31 -------
This will never be release critical.


-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P5


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug tree-optimization/21513] [4.0/4.1 Regression] __builtin_expect getting in the way of uninitialized warnings
       [not found] <bug-21513-10614@http.gcc.gnu.org/bugzilla/>
  2005-10-13  1:48 ` [Bug tree-optimization/21513] [4.0/4.1 Regression] __builtin_expect getting in the way of uninitialized warnings pinskia at gcc dot gnu dot org
  2005-10-31  3:31 ` mmitchel at gcc dot gnu dot org
@ 2005-11-01 10:46 ` alexander_herrmann at yahoo dot com dot au
  2005-12-17 10:27 ` [Bug tree-optimization/21513] [4.0/4.1/4.2 " bonzini at gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: alexander_herrmann at yahoo dot com dot au @ 2005-11-01 10:46 UTC (permalink / raw)
  To: gcc-bugs



------- 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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug tree-optimization/21513] [4.0/4.1/4.2 Regression] __builtin_expect getting in the way of uninitialized warnings
       [not found] <bug-21513-10614@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2005-11-01 10:46 ` alexander_herrmann at yahoo dot com dot au
@ 2005-12-17 10:27 ` bonzini at gnu dot org
  2006-02-27 14:01 ` steven at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: bonzini at gnu dot org @ 2005-12-17 10:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from bonzini at gnu dot org  2005-12-17 10:27 -------
Well, another work around should probably be (untested)

Confirmed, reduced testcase:
void f(void*);
void *g(void);

void _aie_malloc(unsigned int size)
{
   void *aie_memory_heap_ptr;
   if (__builtin_expect(size != 0, true)
     {
       aie_memory_heap_ptr = g();
       if (__builtin_expect (aie_memory_heap_ptr != 0, 1))
         f(aie_memory_heap_ptr);
     }
}

This could be fixed also by folding __builtin_expect of &&, ||, and = like
this:

  __b_e (a && b, 1) => __b_e (a, 1) && __b_e (b, 1)
  __b_e (a && b, 0) => a && __b_e (b, 0)
  __b_e (a || b, 1) => a || __b_e (b, 1)
  __b_e (a || b, 0) => __b_e (a, 0) || __b_e (b, 0)
  __b_e (x, y) => (save_expr (x), __b_e (save_expr (x), y)) (*)

(*) when x has side effects

This could even produce better code (I remember a bug about worse code produced
when putting complex expression within __builtin_expect, but it might be
resolved as of now).


-- 

bonzini at gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bonzini at gnu dot org


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug tree-optimization/21513] [4.0/4.1/4.2 Regression] __builtin_expect getting in the way of uninitialized warnings
       [not found] <bug-21513-10614@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2005-12-17 10:27 ` [Bug tree-optimization/21513] [4.0/4.1/4.2 " bonzini at gnu dot org
@ 2006-02-27 14:01 ` steven at gcc dot gnu dot org
  2006-03-03 17:58 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: steven at gcc dot gnu dot org @ 2006-02-27 14:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from steven at gcc dot gnu dot org  2006-02-27 13:58 -------
Should be fixed by removing the old RTL loop optimizer.


-- 

steven at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug tree-optimization/21513] [4.0/4.1/4.2 Regression] __builtin_expect getting in the way of uninitialized warnings
       [not found] <bug-21513-10614@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2006-02-27 14:01 ` steven at gcc dot gnu dot org
@ 2006-03-03 17:58 ` pinskia at gcc dot gnu dot org
  2006-10-23 21:30 ` pinskia at gcc dot gnu dot org
  2007-09-05 19:54 ` nemet at gcc dot gnu dot org
  7 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-03 17:58 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
   Target Milestone|4.1.0                       |4.2.0


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug tree-optimization/21513] [4.0/4.1/4.2 Regression] __builtin_expect getting in the way of uninitialized warnings
       [not found] <bug-21513-10614@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2006-03-03 17:58 ` pinskia at gcc dot gnu dot org
@ 2006-10-23 21:30 ` pinskia at gcc dot gnu dot org
  2007-09-05 19:54 ` nemet at gcc dot gnu dot org
  7 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-10-23 21:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pinskia at gcc dot gnu dot org  2006-10-23 21:30 -------
*** Bug 29574 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mbligh at mbligh dot org


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug tree-optimization/21513] [4.0/4.1/4.2 Regression] __builtin_expect getting in the way of uninitialized warnings
       [not found] <bug-21513-10614@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2006-10-23 21:30 ` pinskia at gcc dot gnu dot org
@ 2007-09-05 19:54 ` nemet at gcc dot gnu dot org
  7 siblings, 0 replies; 8+ messages in thread
From: nemet at gcc dot gnu dot org @ 2007-09-05 19:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from nemet at gcc dot gnu dot org  2007-09-05 19:54 -------
Subject: Bug 21513

Author: nemet
Date: Wed Sep  5 19:54:29 2007
New Revision: 128147

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=128147
Log:
        PR tree-optimization/21513
        * builtins.c (build_builtin_expect_predicate): New function.
        (fold_builtin_expect): Add argument for expected value.
        Distribute __builtin_expect over short-circuiting operations.
        Fold nested builtin_expects.
        (fold_builtin_2): Adjust call to fold_builtin_expect.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/builtins.c


-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-09-05 19:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-21513-10614@http.gcc.gnu.org/bugzilla/>
2005-10-13  1:48 ` [Bug tree-optimization/21513] [4.0/4.1 Regression] __builtin_expect getting in the way of uninitialized warnings pinskia at gcc dot gnu dot org
2005-10-31  3:31 ` mmitchel at gcc dot gnu dot org
2005-11-01 10:46 ` alexander_herrmann at yahoo dot com dot au
2005-12-17 10:27 ` [Bug tree-optimization/21513] [4.0/4.1/4.2 " bonzini at gnu dot org
2006-02-27 14:01 ` steven at gcc dot gnu dot org
2006-03-03 17:58 ` pinskia at gcc dot gnu dot org
2006-10-23 21:30 ` pinskia at gcc dot gnu dot org
2007-09-05 19:54 ` nemet at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).