aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/powerpc
diff options
context:
space:
mode:
authorAdhemerval Zanella <azanella@linux.vnet.ibm.com>2015-01-28 06:10:41 -0500
committerAdhemerval Zanella <azanella@linux.vnet.ibm.com>2015-03-03 10:01:49 -0500
commit85b290451e4d3ab460a57f1c5966c5827ca807ca (patch)
treec394f048661ba9134a0a9a1fc321022f38e7347b /sysdeps/powerpc
parenta0af371c25ac1f215cf0db64e54cbb9a1b51f78c (diff)
downloadglibc-85b290451e4d3ab460a57f1c5966c5827ca807ca.zip
glibc-85b290451e4d3ab460a57f1c5966c5827ca807ca.tar.gz
glibc-85b290451e4d3ab460a57f1c5966c5827ca807ca.tar.bz2
powerpc: Fix inline feraiseexcept, feclearexcept macros
This patch fixes the inline feraiseexcept and feclearexcept macros for powerpc by casting the input argument to integer before operation on it. It fixes BZ#17776.
Diffstat (limited to 'sysdeps/powerpc')
-rw-r--r--sysdeps/powerpc/bits/fenvinline.h52
1 files changed, 32 insertions, 20 deletions
diff --git a/sysdeps/powerpc/bits/fenvinline.h b/sysdeps/powerpc/bits/fenvinline.h
index 35c2114..894789e 100644
--- a/sysdeps/powerpc/bits/fenvinline.h
+++ b/sysdeps/powerpc/bits/fenvinline.h
@@ -34,29 +34,41 @@
/* Inline definition for feraiseexcept. */
# define feraiseexcept(__excepts) \
- ((__builtin_constant_p (__excepts) \
- && ((__excepts) & ((__excepts)-1)) == 0 \
- && (__excepts) != FE_INVALID) \
- ? ((__excepts) != 0 \
- ? (__extension__ ({ __asm__ __volatile__ \
- ("mtfsb1 %s0" \
- : : "i#*X"(__builtin_ffs (__excepts))); \
- 0; })) \
- : 0) \
- : (feraiseexcept) (__excepts))
+ (__extension__ ({ \
+ int __e = __excepts; \
+ int __ret; \
+ if (__builtin_constant_p (__e) \
+ && (__e & (__e - 1)) == 0 \
+ && __e != FE_INVALID) \
+ { \
+ if (__e != 0) \
+ __asm__ __volatile__ ("mtfsb1 %s0" \
+ : : "i#*X" (__builtin_ffs (__e))); \
+ __ret = 0; \
+ } \
+ else \
+ __ret = feraiseexcept (__e); \
+ __ret; \
+ }))
/* Inline definition for feclearexcept. */
# define feclearexcept(__excepts) \
- ((__builtin_constant_p (__excepts) \
- && ((__excepts) & ((__excepts)-1)) == 0 \
- && (__excepts) != FE_INVALID) \
- ? ((__excepts) != 0 \
- ? (__extension__ ({ __asm__ __volatile__ \
- ("mtfsb0 %s0" \
- : : "i#*X"(__builtin_ffs (__excepts))); \
- 0; })) \
- : 0) \
- : (feclearexcept) (__excepts))
+ (__extension__ ({ \
+ int __e = __excepts; \
+ int __ret; \
+ if (__builtin_constant_p (__e) \
+ && (__e & (__e - 1)) == 0 \
+ && __e != FE_INVALID) \
+ { \
+ if (__e != 0) \
+ __asm__ __volatile__ ("mtfsb0 %s0" \
+ : : "i#*X" (__builtin_ffs (__e))); \
+ __ret = 0; \
+ } \
+ else \
+ __ret = feclearexcept (__e); \
+ __ret; \
+ }))
# endif /* !__NO_MATH_INLINES. */