public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dominiq at lps dot ens.fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libfortran/58020] Code for handling IEEE exceptions
Date: Tue, 30 Jul 2013 17:31:00 -0000	[thread overview]
Message-ID: <bug-58020-4-5IB9o15tZ5@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-58020-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58020

--- Comment #7 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> I see your bug report. There are two matters to track down here. 
> The first one is the diagnostic of 'PR58027'. This may require you 
> to report a line number. That would be great. Testing that I have 
> done is with the gfortran compiler on Krogh's machine and my own 
> with the Intel compiler. I do not have access to the machine you 
> are using.

The ICE leading to PR58027 is

[macbook] bug/IEEE_1% gfc -c IEEE_tests_gfortran.f90
IEEE_tests_gfortran.f90: In function 'ieee_tests':
IEEE_tests_gfortran.f90:304:0: internal compiler error: in
gfc_conv_array_initializer, at fortran/trans-array.c:5512
     SA=transfer(ISCLASS(I),SA)

However any use of ISCLASS leads to the ICE because the parameter array is not
built. To understand why, I have compiled the following test

    integer, parameter :: isclass = Z'FF800000'
end

and got

isclass_2.f90:1.35:

    integer, parameter :: isclass = Z'FF800000'
                                   1
Error: Arithmetic overflow converting INTEGER(16) to INTEGER(4) at (1). This
check can be disabled with the option -fno-range-check

with -m64 and

isclass_2.f90:1.35:

    integer, parameter :: isclass = Z'FF800000'
                                   1
Error: Arithmetic overflow converting INTEGER(8) to INTEGER(4) at (1). This
check can be disabled with the option -fno-range-check

with -m32. The gfortran rationale is that Z'FF800000' is converted to the
highest integer kind (8 with -m32 or 16 with -m64) as 2**32-8388608, i.e., a
positive number larger that huge(1)=2**31-1.

> The second matter is the difference in a line of output. That is the
> printing of the 4 digit approximation to \pi. The internal constant \pi
> itself comes from the stored value in the x87. The output of the number
> comes from the routine messy. I expect the hardware value is correct. So
> one machine writes 3.141 wit messy, and the other 3.142.

Apparently 'CALL IEEE_SET_ROUNDING_MODE(IEEE_TO_ZERO)' propagates into

    call messy(E,'$N Double precision rounding mode IEEE_DOWN&
      & for \pi ~= $R agrees with IEEE_TO_ZERO.',rdat=[DA])

If I add

  CALL IEEE_SET_ROUNDING_MODE(IEEE_NEAREST)

before the line

  IF(DC == DA) THEN ! Round down should agree withround to zero, here.

then my output matches the one in list.


  parent reply	other threads:[~2013-07-30 17:31 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-29 17:05 [Bug libfortran/58020] New: " fkrogh#gcc at mathalacarte dot com
2013-07-29 19:29 ` [Bug libfortran/58020] " kargl at gcc dot gnu.org
2013-07-29 21:03 ` fkrogh#gcc at mathalacarte dot com
2013-07-29 22:01 ` sgk at troutmask dot apl.washington.edu
2013-07-30 12:48 ` dominiq at lps dot ens.fr
2013-07-30 14:14 ` burnus at gcc dot gnu.org
2013-07-30 14:36 ` richard.koolhans at gmail dot com
2013-07-30 17:31 ` dominiq at lps dot ens.fr [this message]
2013-07-30 17:37 ` sgk at troutmask dot apl.washington.edu
2013-07-30 17:55 ` fkrogh#gcc at mathalacarte dot com
2013-07-31 17:27 ` richard.koolhans at gmail dot com
2013-08-01 13:00 ` dominiq at lps dot ens.fr
2013-08-01 15:51 ` richard.koolhans at gmail dot com
2013-11-05 13:56 ` fxcoudert at gcc dot gnu.org
2013-11-05 14:05 ` fkrogh at mathalacarte dot com
2013-11-05 14:08 ` fkrogh at mathalacarte dot com
2013-11-05 15:52 ` burnus at gcc dot gnu.org
2013-11-05 16:12 ` fxcoudert at gcc dot gnu.org
2013-11-05 16:27 ` sgk at troutmask dot apl.washington.edu
2013-11-05 16:37 ` fxcoudert at gcc dot gnu.org
2013-11-05 17:05 ` richard.koolhans at gmail dot com
2013-11-05 17:43 ` sgk at troutmask dot apl.washington.edu
2013-11-06 12:28 ` fxcoudert at gcc dot gnu.org
2013-11-25  0:59 ` kargl at gcc dot gnu.org
2014-06-07 10:19 ` fxcoudert 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-58020-4-5IB9o15tZ5@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).