public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "vincent-gcc at vinc17 dot net" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/110011] New: -mfull-toc yields incorrect _Float128 constants on power9 Date: Sun, 28 May 2023 00:32:35 +0000 [thread overview] Message-ID: <bug-110011-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110011 Bug ID: 110011 Summary: -mfull-toc yields incorrect _Float128 constants on power9 Product: gcc Version: 8.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: vincent-gcc at vinc17 dot net Target Milestone: --- Note: I selected version 8.3.1, because this is what I had for my tests, but at least 13.1.0 is still affected (see below). We got a report of a GNU MPFR failure on an IBM POWER9 machine: https://sympa.inria.fr/sympa/arc/mpfr/2023-05/msg00000.html With additional information given in a private discussion, Matthew R. Wilson found that the failure came from the use of -mfull-toc in CFLAGS (this is not visible in the report mentioned above), and he could reproduce the behavior with GCC 13.1.0, 12.2.0, as well as the Debian-provided GCC 10.2.1. As he noticed, -mfull-toc is documented to be the default, so that this shouldn't have any effect. I could reproduce the failure on gcc135 at the Compile Farm with /opt/at12.0/bin/gcc (gcc (GCC) 8.3.1 20190304 (Advance-Toolchain-at12.0) [revision 269374]), and I did some tests with it. It appears that when -mfull-toc is provided, the cause is incorrect _Float128 constants MPFR_FLOAT128_MAX and -MPFR_FLOAT128_MAX, where one has #define MPFR_FLOAT128_MAX 0x1.ffffffffffffffffffffffffffffp+16383f128 Indeed, I added _Float128 m = MPFR_FLOAT128_MAX, n = -MPFR_FLOAT128_MAX; at the beginning of the mpfr_set_float128 function in src/set_float128.c, and did the following: 1. Compile MPFR (and the testsuite) using CFLAGS="-mcpu=power9 -O0 -g -mfull-toc" 2. In the "tests" directory, gdb ./tset_float128 3. Add a breakpoint on mpfr_set_float128, then run, next, and print values: (gdb) print m $1 = 5.96937875341074040910051755689516189e-4947 (gdb) print n $2 = 1.19416736664469867978830578385372193e-4946 Both are wrong. If I do the same test with CFLAGS="-mcpu=power9 -O0 -g" (i.e. without -mfull-toc), then I get (gdb) print m $1 = 1.18973149535723176508575932662800702e+4932 (gdb) print n $2 = -1.18973149535723176508575932662800702e+4932 These are the expected values. Unfortunately, I couldn't reproduce the issue with a simple C program.
next reply other threads:[~2023-05-28 0:32 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-05-28 0:32 vincent-gcc at vinc17 dot net [this message] 2023-05-28 3:41 ` [Bug target/110011] -mfull-toc (-mfp-in-toc) " pinskia at gcc dot gnu.org 2023-05-28 3:54 ` pinskia at gcc dot gnu.org 2023-05-30 6:47 ` linkw at gcc dot gnu.org 2023-05-30 7:51 ` vincent-gcc at vinc17 dot net 2023-05-30 8:09 ` linkw at gcc dot gnu.org 2023-05-30 8:11 ` linkw at gcc dot gnu.org 2023-06-12 6:10 ` cvs-commit at gcc dot gnu.org 2023-06-19 9:29 ` cvs-commit at gcc dot gnu.org 2023-06-20 3:20 ` cvs-commit at gcc dot gnu.org 2023-06-20 3:21 ` cvs-commit at gcc dot gnu.org 2023-06-20 8:24 ` cvs-commit at gcc dot gnu.org 2023-06-20 8:27 ` LpSolit at gmail dot com
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=bug-110011-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.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: linkBe 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).