bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

defeat -flto GCC optimization in math autoconf tests


From: Bruno Haible
Subject: defeat -flto GCC optimization in math autoconf tests
Date: Sun, 18 Aug 2019 16:14:17 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-157-generic; KDE/5.18.0; x86_64; ; )

2019-08-18  Bruno Haible  <address@hidden>

        Defeat -flto GCC optimization in math autoconf tests.
        Reported by Tomasz Kłoczko <address@hidden>
        at <https://savannah.gnu.org/bugs/?56109>.
        * m4/mathfunc.m4 (gl_MATHFUNC): Mark function pointer as 'volatile'.
        * m4/acosl.m4 (gl_FUNC_ACOSL): Likewise.
        * m4/asinl.m4 (gl_FUNC_ASINL): Likewise.
        * m4/atanl.m4 (gl_FUNC_ATANL): Likewise.
        * m4/cosl.m4 (gl_FUNC_COSL): Likewise.
        * m4/exp2.m4 (gl_FUNC_EXP2): Likewise.
        * m4/expl.m4 (gl_FUNC_EXPL): Likewise.
        * m4/expm1.m4 (gl_FUNC_EXPM1): Likewise.
        * m4/expm1l.m4 (gl_FUNC_EXPM1L): Likewise.
        * m4/sinl.m4 (gl_FUNC_SINL): Likewise.
        * m4/sqrtl.m4 (gl_FUNC_SQRTL): Likewise.
        * m4/tanl.m4 (gl_FUNC_TANL): Likewise.

diff --git a/m4/acosl.m4 b/m4/acosl.m4
index 1e4223b..a15ff68 100644
--- a/m4/acosl.m4
+++ b/m4/acosl.m4
@@ -1,4 +1,4 @@
-# acosl.m4 serial 8
+# acosl.m4 serial 9
 dnl Copyright (C) 2010-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -22,7 +22,7 @@ AC_DEFUN([gl_FUNC_ACOSL],
              # define __NO_MATH_INLINES 1 /* for glibc */
              #endif
              #include <math.h>
-             long double (*funcptr) (long double) = acosl;
+             long double (* volatile funcptr) (long double) = acosl;
              long double x;]],
            [[return funcptr (x) > 1
                     || acosl (x) > 1;]])],
@@ -41,7 +41,7 @@ AC_DEFUN([gl_FUNC_ACOSL],
                # define __NO_MATH_INLINES 1 /* for glibc */
                #endif
                #include <math.h>
-               long double (*funcptr) (long double) = acosl;
+               long double (* volatile funcptr) (long double) = acosl;
                long double x;]],
              [[return funcptr (x) > 1
                       || acosl (x) > 1;]])],
diff --git a/m4/asinl.m4 b/m4/asinl.m4
index 40c8c94..0698bd9 100644
--- a/m4/asinl.m4
+++ b/m4/asinl.m4
@@ -1,4 +1,4 @@
-# asinl.m4 serial 8
+# asinl.m4 serial 9
 dnl Copyright (C) 2010-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -22,7 +22,7 @@ AC_DEFUN([gl_FUNC_ASINL],
              # define __NO_MATH_INLINES 1 /* for glibc */
              #endif
              #include <math.h>
-             long double (*funcptr) (long double) = asinl;
+             long double (* volatile funcptr) (long double) = asinl;
              long double x;]],
            [[return funcptr (x) > 1
                     || asinl (x) > 1;]])],
@@ -41,7 +41,7 @@ AC_DEFUN([gl_FUNC_ASINL],
                # define __NO_MATH_INLINES 1 /* for glibc */
                #endif
                #include <math.h>
-               long double (*funcptr) (long double) = asinl;
+               long double (* volatile funcptr) (long double) = asinl;
                long double x;]],
              [[return funcptr (x) > 1
                       || asinl (x) > 1;]])],
diff --git a/m4/atanl.m4 b/m4/atanl.m4
index 171e540..5e7294c 100644
--- a/m4/atanl.m4
+++ b/m4/atanl.m4
@@ -1,4 +1,4 @@
-# atanl.m4 serial 8
+# atanl.m4 serial 9
 dnl Copyright (C) 2010-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -22,7 +22,7 @@ AC_DEFUN([gl_FUNC_ATANL],
              # define __NO_MATH_INLINES 1 /* for glibc */
              #endif
              #include <math.h>
-             long double (*funcptr) (long double) = atanl;
+             long double (* volatile funcptr) (long double) = atanl;
              long double x;]],
            [[return funcptr (x) > 1
                     || atanl (x) > 1;]])],
@@ -41,7 +41,7 @@ AC_DEFUN([gl_FUNC_ATANL],
                # define __NO_MATH_INLINES 1 /* for glibc */
                #endif
                #include <math.h>
-               long double (*funcptr) (long double) = atanl;
+               long double (* volatile funcptr) (long double) = atanl;
                long double x;]],
              [[return funcptr (x) > 1
                       || atanl (x) > 1;]])],
diff --git a/m4/cosl.m4 b/m4/cosl.m4
index 669070a..c078bdc 100644
--- a/m4/cosl.m4
+++ b/m4/cosl.m4
@@ -1,4 +1,4 @@
-# cosl.m4 serial 8
+# cosl.m4 serial 9
 dnl Copyright (C) 2010-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -22,7 +22,7 @@ AC_DEFUN([gl_FUNC_COSL],
              # define __NO_MATH_INLINES 1 /* for glibc */
              #endif
              #include <math.h>
-             long double (*funcptr) (long double) = cosl;
+             long double (* volatile funcptr) (long double) = cosl;
              long double x;]],
            [[return funcptr (x) > 0.4
                     || cosl (x) > 0.4;]])],
@@ -41,7 +41,7 @@ AC_DEFUN([gl_FUNC_COSL],
                # define __NO_MATH_INLINES 1 /* for glibc */
                #endif
                #include <math.h>
-               long double (*funcptr) (long double) = cosl;
+               long double (* volatile funcptr) (long double) = cosl;
                long double x;]],
              [[return funcptr (x) > 0.4
                       || cosl (x) > 0.4;]])],
diff --git a/m4/exp2.m4 b/m4/exp2.m4
index c5c58bd..b6cf666 100644
--- a/m4/exp2.m4
+++ b/m4/exp2.m4
@@ -1,4 +1,4 @@
-# exp2.m4 serial 2
+# exp2.m4 serial 3
 dnl Copyright (C) 2010-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -26,7 +26,7 @@ AC_DEFUN([gl_FUNC_EXP2],
              "C"
              #endif
              double exp2 (double);
-             double (*funcptr) (double) = exp2;
+             double (* volatile funcptr) (double) = exp2;
              double x;]],
            [[return funcptr (x) > 1.5
                     || exp2 (x) > 1.5;]])],
@@ -50,7 +50,7 @@ AC_DEFUN([gl_FUNC_EXP2],
                "C"
                #endif
                double exp2 (double);
-               double (*funcptr) (double) = exp2;
+               double (* volatile funcptr) (double) = exp2;
                double x;]],
              [[return funcptr (x) > 1.5
                       || exp2 (x) > 1.5;]])],
diff --git a/m4/expl.m4 b/m4/expl.m4
index b233046..0619a2d 100644
--- a/m4/expl.m4
+++ b/m4/expl.m4
@@ -1,4 +1,4 @@
-# expl.m4 serial 13
+# expl.m4 serial 14
 dnl Copyright (C) 2010-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -23,7 +23,7 @@ AC_DEFUN([gl_FUNC_EXPL],
              # define __NO_MATH_INLINES 1 /* for glibc */
              #endif
              #include <math.h>
-             long double (*funcptr) (long double) = expl;
+             long double (* volatile funcptr) (long double) = expl;
              long double x;]],
            [[return funcptr (x) > 1.5
                     || expl (x) > 1.5;]])],
@@ -42,7 +42,7 @@ AC_DEFUN([gl_FUNC_EXPL],
                # define __NO_MATH_INLINES 1 /* for glibc */
                #endif
                #include <math.h>
-               long double (*funcptr) (long double) = expl;
+               long double (* volatile funcptr) (long double) = expl;
                long double x;]],
              [[return funcptr (x) > 1.5
                       || expl (x) > 1.5;]])],
diff --git a/m4/expm1.m4 b/m4/expm1.m4
index 088018a..389c7dc 100644
--- a/m4/expm1.m4
+++ b/m4/expm1.m4
@@ -1,4 +1,4 @@
-# expm1.m4 serial 7
+# expm1.m4 serial 8
 dnl Copyright (C) 2010-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -22,7 +22,7 @@ AC_DEFUN([gl_FUNC_EXPM1],
              # define __NO_MATH_INLINES 1 /* for glibc */
              #endif
              #include <math.h>
-             double (*funcptr) (double) = expm1;
+             double (* volatile funcptr) (double) = expm1;
              double x;]],
            [[return funcptr (x) > 0.5
                     || expm1 (x) > 0.5;]])],
@@ -41,7 +41,7 @@ AC_DEFUN([gl_FUNC_EXPM1],
                # define __NO_MATH_INLINES 1 /* for glibc */
                #endif
                #include <math.h>
-               double (*funcptr) (double) = expm1;
+               double (* volatile funcptr) (double) = expm1;
                double x;]],
              [[return funcptr (x) > 0.5
                       || expm1 (x) > 0.5;]])],
diff --git a/m4/expm1l.m4 b/m4/expm1l.m4
index 324b702..5d3a991 100644
--- a/m4/expm1l.m4
+++ b/m4/expm1l.m4
@@ -1,4 +1,4 @@
-# expm1l.m4 serial 4
+# expm1l.m4 serial 5
 dnl Copyright (C) 2010-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -27,7 +27,7 @@ AC_DEFUN([gl_FUNC_EXPM1L],
              "C"
              #endif
              long double expm1l (long double);
-             long double (*funcptr) (long double) = expm1l;
+             long double (* volatile funcptr) (long double) = expm1l;
              long double x;]],
            [[return funcptr (x) > 0.5
                     || expm1l (x) > 0.5;]])],
@@ -51,7 +51,7 @@ AC_DEFUN([gl_FUNC_EXPM1L],
                "C"
                #endif
                long double expm1l (long double);
-               long double (*funcptr) (long double) = expm1l;
+               long double (* volatile funcptr) (long double) = expm1l;
                long double x;]],
              [[return funcptr (x) > 0.5
                       || expm1l (x) > 0.5;]])],
diff --git a/m4/mathfunc.m4 b/m4/mathfunc.m4
index 91b538a..b9a5726 100644
--- a/m4/mathfunc.m4
+++ b/m4/mathfunc.m4
@@ -1,4 +1,4 @@
-# mathfunc.m4 serial 11
+# mathfunc.m4 serial 12
 dnl Copyright (C) 2010-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -60,7 +60,7 @@ AC_DEFUN([gl_MATHFUNC],
              #endif
              #include <math.h>
              $4
-             $2 (*funcptr) $3 = ]func[;
+             $2 (* volatile funcptr) $3 = ]func[;
              int i_ret;
              float f_ret;
              double d_ret;
@@ -85,7 +85,7 @@ AC_DEFUN([gl_MATHFUNC],
                #endif
                #include <math.h>
                $4
-               $2 (*funcptr) $3 = ]func[;
+               $2 (* volatile funcptr) $3 = ]func[;
                int i_ret;
                float f_ret;
                double d_ret;
diff --git a/m4/sinl.m4 b/m4/sinl.m4
index 975ea52..b3599ef 100644
--- a/m4/sinl.m4
+++ b/m4/sinl.m4
@@ -1,4 +1,4 @@
-# sinl.m4 serial 8
+# sinl.m4 serial 9
 dnl Copyright (C) 2010-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -22,7 +22,7 @@ AC_DEFUN([gl_FUNC_SINL],
              # define __NO_MATH_INLINES 1 /* for glibc */
              #endif
              #include <math.h>
-             long double (*funcptr) (long double) = sinl;
+             long double (* volatile funcptr) (long double) = sinl;
              long double x;]],
            [[return funcptr (x) > 0.4
                     || sinl (x) > 0.4;]])],
@@ -41,7 +41,7 @@ AC_DEFUN([gl_FUNC_SINL],
                # define __NO_MATH_INLINES 1 /* for glibc */
                #endif
                #include <math.h>
-               long double (*funcptr) (long double) = sinl;
+               long double (* volatile funcptr) (long double) = sinl;
                long double x;]],
              [[return funcptr (x) > 0.4
                       || sinl (x) > 0.4;]])],
diff --git a/m4/sqrtl.m4 b/m4/sqrtl.m4
index 31e94ff..af15c0f 100644
--- a/m4/sqrtl.m4
+++ b/m4/sqrtl.m4
@@ -1,4 +1,4 @@
-# sqrtl.m4 serial 10
+# sqrtl.m4 serial 11
 dnl Copyright (C) 2010-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -22,7 +22,7 @@ AC_DEFUN([gl_FUNC_SQRTL],
              # define __NO_MATH_INLINES 1 /* for glibc */
              #endif
              #include <math.h>
-             long double (*funcptr) (long double) = sqrtl;
+             long double (* volatile funcptr) (long double) = sqrtl;
              long double x;]],
            [[return funcptr (x) > 0.4
                     || sqrtl (x) > 0.4;]])],
@@ -41,7 +41,7 @@ AC_DEFUN([gl_FUNC_SQRTL],
                # define __NO_MATH_INLINES 1 /* for glibc */
                #endif
                #include <math.h>
-               long double (*funcptr) (long double) = sqrtl;
+               long double (* volatile funcptr) (long double) = sqrtl;
                long double x;]],
              [[return funcptr (x) > 0.4
                       || sqrtl (x) > 0.4;]])],
diff --git a/m4/tanl.m4 b/m4/tanl.m4
index 4a45a7a..8cd75fb 100644
--- a/m4/tanl.m4
+++ b/m4/tanl.m4
@@ -1,4 +1,4 @@
-# tanl.m4 serial 8
+# tanl.m4 serial 9
 dnl Copyright (C) 2010-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -22,7 +22,7 @@ AC_DEFUN([gl_FUNC_TANL],
              # define __NO_MATH_INLINES 1 /* for glibc */
              #endif
              #include <math.h>
-             long double (*funcptr) (long double) = tanl;
+             long double (* volatile funcptr) (long double) = tanl;
              long double x;]],
            [[return funcptr (x) > 0.4
                     || tanl (x) > 0.4;]])],
@@ -41,7 +41,7 @@ AC_DEFUN([gl_FUNC_TANL],
                # define __NO_MATH_INLINES 1 /* for glibc */
                #endif
                #include <math.h>
-               long double (*funcptr) (long double) = tanl;
+               long double (* volatile funcptr) (long double) = tanl;
                long double x;]],
              [[return funcptr (x) > 0.4
                       || tanl (x) > 0.4;]])],




reply via email to

[Prev in Thread] Current Thread [Next in Thread]