public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "Paul E. Murphy" <murphyp@linux.vnet.ibm.com>
To: libc-alpha@sourceware.org
Subject: [PATCH v3 1/6] ldbl-128ibm-compat: workaround GCC 9 C++ BZ 90731
Date: Mon,  6 Apr 2020 14:12:34 -0500	[thread overview]
Message-ID: <fbe4cf4276936fdf5a21d808f9a7cb3ce4702fa8.1586199342.git.murphyp@linux.vnet.ibm.com> (raw)
In-Reply-To: <cover.1586199342.git.murphyp@linux.vnet.ibm.com>

GCC 9 has a bug (BZ 90731) whereby __typeof does not correctly copy
exception specifiers[1].  Surprisingly, this can be quieted by declaring
"#pragma system_header", or if the headers are installed in a system
directory.

Work around this by using the pragma for any gcc version between
9.0 and 9.2 to ensure tests continue to compile.

[1] Example error from g++ 9.2.1:

In file included from ../include/sys/cdefs.h:3,
                 from ../include/features.h:465,
                 from ../bits/libc-header-start.h:33,
                 from ../math/math.h:27,
                 from ../include/math.h:7,
                 from test-math-isinff.cc:21:
../libio/bits/stdio-ldbl.h:25:20: error: declaration of ‘int sprintf(char*, const char*, ...)’ has a different exception specifier
   25 | __LDBL_REDIR_DECL (sprintf)
      |                    ^~~~~~~
../misc/sys/cdefs.h:461:26: note: in definition of macro ‘__LDBL_REDIR_DECL’
  461 |   extern __typeof (name) name __asm (__ASMNAME ("__" #name "ieee128"));
      |                          ^~~~
In file included from ../include/stdio.h:5,
                 from test-math-isinff.cc:22:
../libio/stdio.h:334:12: note: from previous declaration ‘int sprintf(char*, const char*, ...) throw ()’
  334 | extern int sprintf (char *__restrict __s,
      |            ^~~~~~~
---
 include/monetary.h |  8 ++++++++
 include/printf.h   |  8 ++++++++
 include/stdio.h    | 10 ++++++++++
 include/stdlib.h   |  9 +++++++++
 include/wchar.h    |  9 +++++++++
 5 files changed, 44 insertions(+)

diff --git a/include/monetary.h b/include/monetary.h
index 240925e87d..b6da7326c7 100644
--- a/include/monetary.h
+++ b/include/monetary.h
@@ -1,3 +1,11 @@
+/* Workaround BZ 90731 with GCC 9 when using ldbl redirects in C++. */
+#include <bits/floatn.h>
+#if defined __cplusplus && __LONG_DOUBLE_USES_FLOAT128 == 1
+# if __GNUC_PREREQ (9, 0) && !__GNUC_PREREQ (9, 3)
+#   pragma GCC system_header
+# endif
+#endif
+
 #include <stdlib/monetary.h>
 #ifndef _ISOMAC
 #include <stdarg.h>
diff --git a/include/printf.h b/include/printf.h
index d051514119..7430f9a833 100644
--- a/include/printf.h
+++ b/include/printf.h
@@ -1,5 +1,13 @@
 #ifndef	_PRINTF_H
 
+/* Workaround BZ 90731 with GCC 9 when using ldbl redirects in C++. */
+#include <bits/floatn.h>
+#if defined __cplusplus && __LONG_DOUBLE_USES_FLOAT128 == 1
+# if __GNUC_PREREQ (9, 0) && !__GNUC_PREREQ (9, 3)
+#   pragma GCC system_header
+# endif
+#endif
+
 #include <stdio-common/printf.h>
 
 # ifndef _ISOMAC
diff --git a/include/stdio.h b/include/stdio.h
index 6718af4108..8ce73c768b 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -2,8 +2,18 @@
 # if !defined _ISOMAC && defined _IO_MTSAFE_IO
 #  include <stdio-lock.h>
 # endif
+
+/* Workaround BZ 90731 with GCC 9 when using ldbl redirects in C++. */
+# include <bits/floatn.h>
+# if defined __cplusplus && __LONG_DOUBLE_USES_FLOAT128 == 1
+#  if __GNUC_PREREQ (9, 0) && !__GNUC_PREREQ (9, 3)
+#    pragma GCC system_header
+#  endif
+# endif
+
 # include <libio/stdio.h>
 # ifndef _ISOMAC
+
 #  define _LIBC_STDIO_H 1
 #  include <libio/libio.h>
 
diff --git a/include/stdlib.h b/include/stdlib.h
index 926f965f69..d1c4d41ba6 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -3,6 +3,15 @@
 #ifndef _ISOMAC
 # include <stddef.h>
 #endif
+
+/* Workaround BZ 90731 with GCC 9 when using ldbl redirects in C++. */
+#include <bits/floatn.h>
+#if defined __cplusplus && __LONG_DOUBLE_USES_FLOAT128 == 1
+# if __GNUC_PREREQ (9, 0) && !__GNUC_PREREQ (9, 3)
+#   pragma GCC system_header
+# endif
+#endif
+
 #include <stdlib/stdlib.h>
 
 /* Now define the internal interfaces.  */
diff --git a/include/wchar.h b/include/wchar.h
index 617906eb14..e70d275cad 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -1,4 +1,13 @@
 #ifndef _WCHAR_H
+
+/* Workaround BZ 90731 with GCC 9 when using ldbl redirects in C++. */
+# include <bits/floatn.h>
+# if defined __cplusplus && __LONG_DOUBLE_USES_FLOAT128 == 1
+#  if __GNUC_PREREQ (9, 0) && !__GNUC_PREREQ (9, 3)
+#   pragma GCC system_header
+#  endif
+# endif
+
 # include <wcsmbs/wchar.h>
 # ifndef _ISOMAC
 
-- 
2.21.1


  reply	other threads:[~2020-04-06 19:12 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-06 19:12 [PATCH v3 0/6] IEEE binary128 long double on powerpc64le Paul E. Murphy
2020-04-06 19:12 ` Paul E. Murphy [this message]
2020-04-15 14:20   ` [PATCH v3 1/6] ldbl-128ibm-compat: workaround GCC 9 C++ BZ 90731 Paul E Murphy
2020-04-22 14:58     ` Paul E Murphy
2020-04-22 15:11   ` Florian Weimer
2020-04-22 21:17     ` Paul E Murphy
2020-04-23  5:48       ` Florian Weimer
2020-04-06 19:12 ` [PATCH v3 2/6] Rename __LONG_DOUBLE_USES_FLOAT128 to __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI Paul E. Murphy
2020-04-15 14:21   ` Paul E Murphy
2020-04-22 14:59     ` Paul E Murphy
2020-04-06 19:12 ` [PATCH v3 3/6] powerpc64le: raise GCC requirement to 7.4 for long double transition Paul E. Murphy
2020-04-22 15:19   ` Florian Weimer
2020-04-22 19:33     ` Paul E Murphy
2020-04-06 19:12 ` [PATCH v3 4/6] powerpc64le: bump binutils version requirement to >= 2.26 Paul E. Murphy
2020-04-22 15:20   ` Florian Weimer
2020-04-06 19:12 ` [PATCH v3 5/6] powerpc64le: blacklist broken GCC compilers (e.g GCC 7.5.0) Paul E. Murphy
2020-04-22 15:23   ` Florian Weimer
2020-04-06 19:12 ` [PATCH v3 6/6] powerpc64le: Enable support for IEEE long double Paul E. Murphy
2020-04-22 15:03   ` Paul E Murphy
2020-04-22 15:15   ` Florian Weimer
2020-04-22 16:20     ` Paul E Murphy
2020-04-22 16:23       ` Florian Weimer

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=fbe4cf4276936fdf5a21d808f9a7cb3ce4702fa8.1586199342.git.murphyp@linux.vnet.ibm.com \
    --to=murphyp@linux.vnet.ibm.com \
    --cc=libc-alpha@sourceware.org \
    /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).