diff options
author | Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> | 2015-02-10 10:09:49 +0000 |
---|---|---|
committer | Rainer Orth <ro@gcc.gnu.org> | 2015-02-10 10:09:49 +0000 |
commit | 9e271531390b70fd400fdfbd1ba5a774f9fe4df5 (patch) | |
tree | eb3f4a25ccd2cc0944a6e25152366db3f36040e7 /fixincludes/inclhack.def | |
parent | bab4f4e37f5cbaf7807119d40d3b5ebd5bea856f (diff) | |
download | gcc-9e271531390b70fd400fdfbd1ba5a774f9fe4df5.zip gcc-9e271531390b70fd400fdfbd1ba5a774f9fe4df5.tar.gz gcc-9e271531390b70fd400fdfbd1ba5a774f9fe4df5.tar.bz2 |
Fix <iso/math_c99.h> signbit on Solaris
fixincludes:
* inclhack.def (solaris_math_11): New fix.
* fixincl.x: Regenerate.
* tests/base/iso/math_c99.h [SOLARIS_MATH_11_CHECK]: New test.
gcc/testsuite:
* gcc.dg/signbit-sa.c: New test.
From-SVN: r220577
Diffstat (limited to 'fixincludes/inclhack.def')
-rw-r--r-- | fixincludes/inclhack.def | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def index fa9287e..ce9a2ca 100644 --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -3549,6 +3549,58 @@ fix = { }; /* + * Newer Solaris 10/11 GCC signbit implementations cause strict-aliasing + * warnings. + */ +fix = { + hackname = solaris_math_11; + select = '@\(#\)math_c99\.h' "[ \t]+1\\.[0-9]+[ \t]+[0-9/]+ "; + files = iso/math_c99.h; + c_fix = format; + c_fix_arg = << _EOArg_ +#undef signbit +#define signbit(x) (sizeof(x) == sizeof(float) \ + ? __builtin_signbitf(x) \ + : sizeof(x) == sizeof(long double) \ + ? __builtin_signbitl(x) \ + : __builtin_signbit(x)) +_EOArg_; + c_fix_arg = << _EOArg_ +^#undef[ ]+signbit +#if defined\(__sparc\) +#define[ ]+signbit\(x\)[ ]+__extension__\( \\ +[ ]+\{[ ]*__typeof\(x\)[ ]*__x_s[ ]*=[ ]*\(x\);[ ]*\\ +[ ]+\(int\)[ ]*\(\*\(unsigned[ ]*\*\)[ ]*\&__x_s[ ]*>>[ ]*31\);[ ]*\}\) +#elif defined\(__i386\) \|\| defined\(__amd64\) +#define[ ]+signbit\(x\)[ ]+__extension__\( \\ +[ ]+\{ __typeof\(x\) __x_s = \(x\); \\ +[ ]+\(sizeof \(__x_s\) == sizeof \(float\) \? \\ +[ ]+\(int\) \(\*\(unsigned \*\) \&__x_s >> 31\) : \\ +[ ]+sizeof \(__x_s\) == sizeof \(double\) \? \\ +[ ]+\(int\) \(\(\(unsigned \*\) \&__x_s\)\[1\] >> 31\) : \\ +[ ]+\(int\) \(\(\(unsigned short \*\) \&__x_s\)\[4\] >> 15\)\); \}\) +#endif +_EOArg_; + test_text = << _EOText_ +/* @(#)math_c99.h 1.14 13/03/27 */ +#undef signbit +#if defined(__sparc) +#define signbit(x) __extension__( \\ + { __typeof(x) __x_s = (x); \\ + (int) (*(unsigned *) &__x_s >> 31); }) +#elif defined(__i386) || defined(__amd64) +#define signbit(x) __extension__( \\ + { __typeof(x) __x_s = (x); \\ + (sizeof (__x_s) == sizeof (float) ? \\ + (int) (*(unsigned *) &__x_s >> 31) : \\ + sizeof (__x_s) == sizeof (double) ? \\ + (int) (((unsigned *) &__x_s)[1] >> 31) : \\ + (int) (((unsigned short *) &__x_s)[4] >> 15)); }) +#endif +_EOText_; +}; + +/* * Sun Solaris defines PTHREAD_ONCE_INIT as an array containing a * structure. As such, it need two levels of brackets, but only * contains one. Wrap the macro definition in an extra layer. |