Bug 28575 - misleading __builtin_choose_expr documentation error
Summary: misleading __builtin_choose_expr documentation error
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 4.0.1
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: documentation
: 33013 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-08-02 18:45 UTC by twang
Modified: 2014-03-25 16:30 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-08-02 18:50:58


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description twang 2006-08-02 18:45:29 UTC
This documentation error exists for all versions of gcc-3.*, gcc-4.* documentation.

Relevant links are 
http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Other-Builtins.html
http://gcc.gnu.org/onlinedocs/gcc-4.0.3/gcc/Other-Builtins.html

The error text is:
Built-in Function: type __builtin_choose_expr (const_exp, exp1, exp2)
You can use the built-in function __builtin_choose_expr to evaluate code depending on the value of a constant expression. This built-in function returns exp1 if const_exp, which is a constant expression that must be able to be determined at compile time, is nonzero. 

--> Otherwise it returns 0.
should be
--> Otherwise it returns exp2.

This is confusing and misleading for the actual functionailty of the builtin, it shold be changed.
Comment 1 Andrew Pinski 2006-08-02 18:50:58 UTC
Confirmed. This has been an issue since the function was added.
Comment 2 Brian Dominy 2007-09-10 15:49:17 UTC
*** Bug 33013 has been marked as a duplicate of this bug. ***
Comment 3 Vincent Lefèvre 2008-04-24 15:04:17 UTC
Is there any reason why this hasn't been fixed yet? (The trunk still has the error. And I'm asking this because there's only one word to change.)
Comment 4 Przemysław Pawełczyk 2010-11-29 18:06:57 UTC
I'm also curious why the trivial fix has not been applied yet.

--- a/gcc-4.5.1/gcc/doc/extend.texi	2010-11-29 18:39:21.000000000 +0100
+++ b/gcc-4.5.1/gcc/doc/extend.texi	2010-11-29 18:39:54.000000000 +0100
@@ -7026,7 +7026,7 @@
 You can use the built-in function @code{__builtin_choose_expr} to
 evaluate code depending on the value of a constant expression.  This
 built-in function returns @var{exp1} if @var{const_exp}, which is an
-integer constant expression, is nonzero.  Otherwise it returns 0.
+integer constant expression, is nonzero.  Otherwise it returns @var{exp2}.
 
 This built-in function is analogous to the @samp{? :} operator in C,
 except that the expression returned has its type unaltered by promotion
Comment 5 Marek Polacek 2014-03-25 16:30:17 UTC
This was fixed in r163675.