summaryrefslogtreecommitdiff
path: root/m4/floor.m4
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2018-10-14 09:27:21 +0200
committerBruno Haible <bruno@clisp.org>2018-10-14 09:34:49 +0200
commit634ee598d986cc2b9ff13b31aa70b448da471373 (patch)
treef537015ac259c5e3887731a051d5fea64446ff9c /m4/floor.m4
parent6c3b072e6a48d45455b37420caf14b804cbba23c (diff)
downloadgnulib-634ee598d986cc2b9ff13b31aa70b448da471373.tar.gz
floor, ceil, trunc, truncf, truncl: Defeat GCC optimizations.
* m4/floor.m4 (gl_FUNC_FLOOR_LIBS): Use 'floor' also through a function pointer. * m4/ceil.m4 (gl_FUNC_CEIL_LIBS): Use 'ceil' also through a function pointer. * m4/trunc.m4 (gl_FUNC_TRUNC): Use 'trunc' also through a function pointer. * m4/truncf.m4 (gl_FUNC_TRUNCF): Use 'truncf' also through a function pointer. * m4/truncl.m4 (gl_FUNC_TRUNCL): Use 'truncl' also through a function pointer.
Diffstat (limited to 'm4/floor.m4')
-rw-r--r--m4/floor.m48
1 files changed, 5 insertions, 3 deletions
diff --git a/m4/floor.m4 b/m4/floor.m4
index 15fa84d2b1..bef45a1e0d 100644
--- a/m4/floor.m4
+++ b/m4/floor.m4
@@ -1,4 +1,4 @@
-# floor.m4 serial 10
+# floor.m4 serial 11
dnl Copyright (C) 2007, 2009-2018 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -77,8 +77,9 @@ AC_DEFUN([gl_FUNC_FLOOR_LIBS],
# define __NO_MATH_INLINES 1 /* for glibc */
#endif
#include <math.h>
+ double (*funcptr) (double) = floor;
double x;]],
- [[x = floor(x);]])],
+ [[x = funcptr(x) + floor(x);]])],
[gl_cv_func_floor_libm=])
if test "$gl_cv_func_floor_libm" = "?"; then
save_LIBS="$LIBS"
@@ -89,8 +90,9 @@ AC_DEFUN([gl_FUNC_FLOOR_LIBS],
# define __NO_MATH_INLINES 1 /* for glibc */
#endif
#include <math.h>
+ double (*funcptr) (double) = floor;
double x;]],
- [[x = floor(x);]])],
+ [[x = funcptr(x) + floor(x);]])],
[gl_cv_func_floor_libm="-lm"])
LIBS="$save_LIBS"
fi