Bug 36757 - __builtin_signbit should be type-generic
Summary: __builtin_signbit should be type-generic
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: 6.0
Assignee: Francois-Xavier Coudert
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-07 21:28 UTC by Joseph S. Myers
Modified: 2015-08-18 20:09 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2008-12-27 22:14:40


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph S. Myers 2008-07-07 21:28:52 UTC
The function __builtin_signbit should be type-generic so that libraries can
define the standard signbit macro with
"#define signbit(x) __builtin_signbit(x)".

(Mentioned several times before in the context of discussions of the other
type-generic built-in functions, but doesn't seem to be filed in Bugzilla
at present.)

It's necessary to avoid the type-generic signbit expanding to call a library
function that may not exist, but as all currently supported floating-point
formats do have a sign bit specified in signbit_ro I believe the case
of failing to expand inline can be made into an abort.
Comment 1 Andrew Pinski 2008-12-27 22:14:40 UTC
Confirmed.
Comment 2 Francois-Xavier Coudert 2014-09-26 22:13:07 UTC
That would be interesting indeed.
Comment 3 Francois-Xavier Coudert 2015-08-18 20:08:29 UTC
Author: fxcoudert
Date: Tue Aug 18 20:07:57 2015
New Revision: 226990

URL: https://gcc.gnu.org/viewcvs?rev=226990&root=gcc&view=rev
Log:
	PR middle-end/36757

	* builtins.c (expand_builtin_signbit): Add asserts to make sure
	we can expand BUILT_IN_SIGNBIT inline.
	* builtins.def (BUILT_IN_SIGNBIT): Make type-generic.
	* doc/extend.texi: Document the type-generic __builtin_signbit.

	* c-common.c (check_builtin_function_arguments): Add check
	for BUILT_IN_SIGNBIT argument.

	* gcc.dg/builtins-error.c: Add checks for __builtin_signbit.
	* gcc.dg/tg-tests.h: Add checks for __builtin_signbit.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/builtins.c
    trunk/gcc/builtins.def
    trunk/gcc/c-family/ChangeLog
    trunk/gcc/c-family/c-common.c
    trunk/gcc/doc/extend.texi
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/builtins-error.c
    trunk/gcc/testsuite/gcc.dg/tg-tests.h
Comment 4 Francois-Xavier Coudert 2015-08-18 20:09:41 UTC
Fixed on trunk.