libgfortran: Fix bootstrap on targets without static_assert macro.
authorIain Sandoe <iain@sandoe.co.uk>
Fri, 31 Dec 2021 11:52:22 +0000 (11:52 +0000)
committerIain Sandoe <iain@sandoe.co.uk>
Fri, 31 Dec 2021 13:16:16 +0000 (13:16 +0000)
Although we build the library with GCC which is known to support
_Static_assert this might be done on a system without the macro
mapping static_assert to the compiler keyword.

The use of static_assert introduced with r12-6126-g3430132f3e82
causes bootstrap to fail on such targets, fixed by using the keyword
directly.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
libgfortran/ChangeLog:

* runtime/string.c (gfc_itoa): Use _Static_assert directly
instead of via the static_assert macro.

libgfortran/runtime/string.c

index 21585f4..5bc2023 100644 (file)
@@ -242,8 +242,8 @@ gfc_itoa (GFC_UINTEGER_LARGEST n, char *buffer, size_t len)
         integers (we would need three calls), but they do suffice for all
         values up to 2^127, which is the largest that Fortran can produce
         (-HUGE(0_16)-1) with its signed integer types.  */
-      static_assert(sizeof(GFC_UINTEGER_LARGEST) <= 2 * sizeof(uint64_t),
-                   "integer too large");
+      _Static_assert (sizeof(GFC_UINTEGER_LARGEST) <= 2 * sizeof(uint64_t),
+                     "integer too large");
 
       GFC_UINTEGER_LARGEST r;
       r = n % TEN19;