public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jiajing_zheng at 163 dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/113709] New: User -fno-thread-jumps gave Floating point exception at -O2, -O3, -Os
Date: Thu, 01 Feb 2024 18:30:24 +0000	[thread overview]
Message-ID: <bug-113709-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113709

            Bug ID: 113709
           Summary: User -fno-thread-jumps gave Floating point exception
                    at -O2, -O3, -Os
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jiajing_zheng at 163 dot com
  Target Milestone: ---

With -fno-thread-jumps option, GCC-12.2.0 at -O2, O3, -Os optimization levels
generated the 'Floating point exception (core dumped)' message.

jing@jing-ubuntu:~$ cat source.c 
static unsigned int A = 20;
static unsigned int B = 1;

int main(void) {
  int i;
  for (i = 0; i < 2; i++) {
    A *= (B / (A ? A : 3)) / (A ? A : 5);
  }
  return 0;
}

jing@jing-ubuntu:~$ gcc source.c -O0 -fno-thread-jumps && ./a.out
jing@jing-ubuntu:~$ gcc source.c -O1 -fno-thread-jumps && ./a.out
jing@jing-ubuntu:~$ gcc source.c -O2 -fno-thread-jumps && ./a.out
Floating point exception (core dumped)
jing@jing-ubuntu:~$ gcc source.c -O3 -fno-thread-jumps && ./a.out
Floating point exception (core dumped)
jing@jing-ubuntu:~$ gcc source.c -Os -fno-thread-jumps && ./a.out
Floating point exception (core dumped)


jing@jing-ubuntu:~$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/jing/gcc-12.2.0/usr/local/bin/../libexec/gcc/x86_64-pc-linux-gnu/12.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure -enable-checking=release -enable-languages=c,c++
-disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.2.0 (GCC)

             reply	other threads:[~2024-02-01 18:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-01 18:30 jiajing_zheng at 163 dot com [this message]
2024-02-01 22:10 ` [Bug middle-end/113709] [12 Regression] " pinskia at gcc dot gnu.org
2024-02-01 22:16 ` pinskia at gcc dot gnu.org

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-113709-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: 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).