This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/34781] New: __builtin_expect()'s first argument should be treated like other conditional expressions


Namely, un-parenthesized assignments should be warned about, as in:

void func(void);

void test(int n) {
        if(n = 1)
                func();
        if(__builtin_expect(n = 1, 0))
                func();
}

If __builtin_expect() is expected to be used outside of conditionals (the only
useful case I can see is inside switch()), then the treatment of the argument
should be done with knowledge of the surrounding context.


-- 
           Summary: __builtin_expect()'s first argument should be treated
                    like other conditional expressions
           Product: gcc
           Version: 4.2.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jbeulich at novell dot com
 GCC build triplet: *-*-*
  GCC host triplet: *-*-*
GCC target triplet: *-*-*


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]