public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Kao Dome <kaodome@icloud.com>
To: binutils@sourceware.org
Subject: LTO seems to change the outcome of the division by zero raises SIGFPE test.
Date: Wed, 13 Jul 2022 16:58:32 -0000	[thread overview]
Message-ID: <2f6b659b-79a1-489f-a28a-bc5d5ae5e885@me.com> (raw)

Hi, when I noticed it I was building binutils in MSYS2 (so, Windows) I checked in Linux to see if the same would happen and it seems to.The test itself is in the intl configure script, but I'll reproduce it here:------------------#include <stdlib.h>#include <signal.h>static void#ifdef __cplusplussigfpe_handler (int sig)#elsesigfpe_handler (sig) int sig;#endif{  /* Exit with code 0 if SIGFPE, with code 1 if any other signal.  */  exit (sig != SIGFPE);}int x = 1;int y = 0;int z;int nan;int main (){  signal (SIGFPE, sigfpe_handler);/* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP.  */#if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP)  signal (SIGTRAP, sigfpe_handler);#endif/* Linux/SPARC yields signal SIGILL.  */#if defined (__sparc__) && defined (__linux__)  signal (SIGILL, sigfpe_handler);#endif  z = x / y;  nan = y / y;  exit (1);}------------------When CFLAGS include a flavor of LTO, for example, "-flto", executing the binary leads to a return value of 1, but it exists through the one at end of the program, *not* the signal handler. When no LTO is used, executing returns 0. Also, it happens when CFLAGS have some optimization going on, so it'd be "-O2 -flto" vs "-O2" for example.I don't think it is important, but because it defines INTDIV0_RAISES_SIGFPE to either 1 or 0, I'm guessing it is there for a reason and means something in intl, so I decided to report it just in case.That's the only thing that changes throughout the whole configuration phase when having LTO in CFLAGS, the rest stays the same (save ar and the like which are set to gcc-ar). The versions of what I'm using to build are GCC 12.1.0 and Binutils 2.38.Regards,Kao.

             reply	other threads:[~2022-07-13 16:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-13 16:58 Kao Dome [this message]
2022-07-26 13:49 ` Nick Clifton

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=2f6b659b-79a1-489f-a28a-bc5d5ae5e885@me.com \
    --to=kaodome@icloud.com \
    --cc=binutils@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).