diff m4/trunc.m4 @ 39912:062361de7628

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.
author Bruno Haible <bruno@clisp.org>
date Sun, 14 Oct 2018 09:27:21 +0200
parents 10eb9086bea0
children b06060465f09
line wrap: on
line diff
--- a/m4/trunc.m4	Sat Oct 13 07:16:00 2018 +0200
+++ b/m4/trunc.m4	Sun Oct 14 09:27:21 2018 +0200
@@ -1,4 +1,4 @@
-# trunc.m4 serial 11
+# trunc.m4 serial 12
 dnl Copyright (C) 2007, 2010-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,
@@ -21,8 +21,9 @@
            # define __NO_MATH_INLINES 1 /* for glibc */
            #endif
            #include <math.h>
+           double (*funcptr) (double) = trunc;
            double x;]],
-         [[x = trunc(x);]])],
+         [[x = funcptr(x) + trunc(x);]])],
       [TRUNC_LIBM=])
     if test "$TRUNC_LIBM" = "?"; then
       save_LIBS="$LIBS"
@@ -33,8 +34,9 @@
              # define __NO_MATH_INLINES 1 /* for glibc */
              #endif
              #include <math.h>
+             double (*funcptr) (double) = trunc;
              double x;]],
-           [[x = trunc(x);]])],
+           [[x = funcptr(x) + trunc(x);]])],
         [TRUNC_LIBM="-lm"])
       LIBS="$save_LIBS"
     fi