public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: FX <fxcoudert@gmail.com>
To: Thomas Koenig <tkoenig@netcologne.de>
Cc: gcc-patches@gcc.gnu.org, fortran@gcc.gnu.org, ro@gcc.gnu.org
Subject: Re: [PATCH] Make integer output faster in libgfortran
Date: Mon, 27 Dec 2021 22:01:00 +0100	[thread overview]
Message-ID: <D7F524F1-793A-4E5B-9BC4-2D5F94A8B301@gmail.com> (raw)
In-Reply-To: <1471f348-1829-b253-86f3-47abb9182e25@netcologne.de>

[-- Attachment #1: Type: text/plain, Size: 369 bytes --]

Follow-up patch committed, after my use of the one-argument variant of static_assert() broke bootstrap on Solaris (sorry Rainer!).
The one-arg form is new since C23, while Solaris <assert.h> only supports the two-arg form (C11).

I have confirmed that other target libraries use the two-arg form, and bootstrapped the attached patch on x86_64-pc-linux-gnu.

FX


[-- Attachment #2: static_assert.diff --]
[-- Type: application/octet-stream, Size: 1030 bytes --]

commit 3430132f3e8289f1b789a1a91206c44c47fb032c
Author: Francois-Xavier Coudert <fxcoudert@gmail.com>
Date:   2021-12-27 21:32:08 +0100

    Fortran: fix use of static_assert() to conform to C11
    
    libgfortran/ChangeLog:
    
            PR libfortran/98076
            * runtime/string.c (gfc_itoa): Use two args for static_assert().

diff --git a/libgfortran/runtime/string.c b/libgfortran/runtime/string.c
index 0ccd731852a..21585f48dc9 100644
--- a/libgfortran/runtime/string.c
+++ b/libgfortran/runtime/string.c
@@ -242,7 +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));
+      static_assert(sizeof(GFC_UINTEGER_LARGEST) <= 2 * sizeof(uint64_t),
+		    "integer too large");
 
       GFC_UINTEGER_LARGEST r;
       r = n % TEN19;

      reply	other threads:[~2021-12-27 21:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-25 13:03 FX
2021-12-25 14:35 ` Thomas Koenig
2021-12-25 14:50   ` FX
2021-12-25 22:07     ` Thomas Koenig
2021-12-26 11:14       ` FX
2021-12-26 16:15         ` Thomas Koenig
2021-12-27 21:01           ` FX [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=D7F524F1-793A-4E5B-9BC4-2D5F94A8B301@gmail.com \
    --to=fxcoudert@gmail.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=ro@gcc.gnu.org \
    --cc=tkoenig@netcologne.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).