]> Savannah Git Hosting - gnulib.git/commitdiff
frexp: pacify clang re address-of-volatile
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 2 Dec 2023 06:19:22 +0000 (22:19 -0800)
committerBruno Haible <bruno@clisp.org>
Thu, 18 Jan 2024 08:12:42 +0000 (09:12 +0100)
Problem reported by Sam James in:
https://lists.gnu.org/r/bug-gnulib/2023-12/msg00013.html
* m4/frexp.m4 (gl_FUNC_FREXP_WORKS): Don’t try to convert
‘double volatile *’ to ‘void const *’ as the C standard
doesn’t allow accessing volatile variables through
pointer-to-nonvolatile.
* m4/frexpf.m4 (gl_FUNC_FREXPF_WORKS): Likewise.

ChangeLog
m4/frexp.m4
m4/frexpf.m4

index 49fdf2c8458c428a2fca3d1701b9a873ecac3d16..103d66e0d0f55080f06122681901239075f18b23 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2023-12-01  Paul Eggert  <eggert@cs.ucla.edu>
+
+       frexp, frexpf: pacify clang re address-of-volatile
+       Problem reported by Sam James in:
+       https://lists.gnu.org/r/bug-gnulib/2023-12/msg00013.html
+       * m4/frexp.m4 (gl_FUNC_FREXP_WORKS): Don’t try to convert
+       ‘double volatile *’ to ‘void const *’ as the C standard
+       doesn’t allow accessing volatile variables through
+       pointer-to-nonvolatile.
+       * m4/frexpf.m4 (gl_FUNC_FREXPF_WORKS): Likewise.
+
 2023-12-01  Bruno Haible  <bruno@clisp.org>
 
        obstack: Avoid undefined behaviour.
index 0480d98f304faa63945cfb695f1ae66cb0ea99d3..c9e61e942da6169e13a00f777b19f1da4dae7099 100644 (file)
@@ -1,4 +1,4 @@
-# frexp.m4 serial 16
+# frexp.m4 serial 16.1
 dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -156,7 +156,8 @@ int main()
   {
     int exp;
     double y = frexp (x, &exp);
-    if (memcmp (&y, &x, sizeof x))
+    double x1 = x;
+    if (memcmp (&y, &x1, sizeof x1))
       result |= 4;
   }
   return result;
index 94a7ef6801b98aee1000d89c35a1ab836ce7d449..57c6462cad74cb55a8622adfd6fe5fefce7fca38 100644 (file)
@@ -1,4 +1,4 @@
-# frexpf.m4 serial 6
+# frexpf.m4 serial 6.1
 dnl Copyright (C) 2011-2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -80,7 +80,8 @@ int main()
   {
     int exp;
     float y = frexpf (x, &exp);
-    if (memcmp (&y, &x, sizeof x))
+    float x1 = x;
+    if (memcmp (&y, &x1, sizeof x1))
       result |= 2;
   }
   return result;