This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/34781] New: __builtin_expect()'s first argument should be treated like other conditional expressions
- From: "jbeulich at novell dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 14 Jan 2008 15:19:26 -0000
- Subject: [Bug c/34781] New: __builtin_expect()'s first argument should be treated like other conditional expressions
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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