public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "thomas.huxhorn at web dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libfortran/96613] New: SIGFPE on min1() with -ffpe-trap=invalid switch
Date: Fri, 14 Aug 2020 09:09:13 +0000	[thread overview]
Message-ID: <bug-96613-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 96613
           Summary: SIGFPE on min1() with -ffpe-trap=invalid switch
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: thomas.huxhorn at web dot de
  Target Milestone: ---

The program fails if -ffpe-trap=invalid is present and no optimization flag is
set. It print 5000 with any optimization level set.

The expected behavior is that it print 5000 with no optimization.

Perhaps it is possible to first calculate the minimum of both real values and
then convert it to integer?

Testet with gcc 10.1 and 4.9
Compile with gfortran -ffpe-trap=invalid  -g -ggdb -fbacktrace   test.f90 

program test
  implicit none
  real :: X
  integer :: IX

  X = 7.7643945e+09
  IX = MIN1(5000.0, X)
  write(*,*) IX
end program

gdb ./a.out 
(gdb) run
Starting program: /home/thomas/a.out 
Program received signal SIGFPE, Arithmetic exception.
0x0000000000400794 in test () at test.f90:8
8         IX = MIN1(5000.0, X)

             reply	other threads:[~2020-08-14  9:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-14  9:09 thomas.huxhorn at web dot de [this message]
2020-08-14 15:58 ` [Bug libfortran/96613] " kargl at gcc dot gnu.org
2020-08-14 15:59 ` [Bug fortran/96613] " kargl at gcc dot gnu.org
2020-08-16 19:55 ` anlauf at gcc dot gnu.org
2020-08-16 19:55 ` anlauf at gcc dot gnu.org
2020-08-16 21:52 ` kargl at gcc dot gnu.org
2020-08-17 18:03 ` anlauf at gcc dot gnu.org
2020-08-17 18:55 ` sgk at troutmask dot apl.washington.edu
2020-08-17 19:05 ` anlauf at gcc dot gnu.org
2020-08-17 20:37 ` anlauf at gcc dot gnu.org
2020-08-18 19:49 ` cvs-commit at gcc dot gnu.org
2020-08-18 20:08 ` anlauf at gcc dot gnu.org
2020-08-20 18:51 ` thomas.huxhorn at web dot de

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-96613-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).