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 fortran/60128] [4.8/4.9 Regression] Wrong ouput using en edit descriptor
Date: Thu, 20 Mar 2014 17:30:00 -0000	[thread overview]
Message-ID: <bug-60128-4-JFUvZB1OQ9@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-60128-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #34 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> I ran the test on Solaris 9 and 11 and looked at the resulting .sum
> files.  Seeing the Unsupported rounding entries on Solaris 11 (any
> platform without the rounding issue actually) seemed strange/backwards
> at first (double negation) until I understood how it's done.

I agree that direct logic is better than double negation. With the following
patch

--- ../_clean/gcc/testsuite/gfortran.dg/fmt_en.f90    2014-03-08
10:02:08.000000000 +0100
+++ gcc/testsuite/gfortran.dg/fmt_en.f90    2014-03-20 18:26:49.000000000 +0100
@@ -2,8 +2,40 @@
 ! PR60128 Invalid outputs with EN descriptors
 ! Test case provided by Walt Brainerd.
 program pr60128
-implicit none
+use ISO_FORTRAN_ENV
+    implicit none
+    integer, parameter :: j(size(real_kinds)+4)=[REAL_KINDS, [4, 4, 4, 4]]
+    logical :: l_skip(4) = .false.
+    integer :: i
     integer :: n_tst = 0, n_cnt = 0
+    character(len=20) :: s
+
+    open (unit = 10, file = 'fmt_en.res')
+!   Check that the default rounding mode is to nearest and to even on tie.
+    do i=1,size(real_kinds)
+      if (i == 1) then
+        write(s, '(2F4.1,2F4.0)') real(-9.49999905,kind=j(1)), &
+                                  real(9.49999905,kind=j(1)),  &
+                                  real(9.5,kind=j(1)), real(8.5,kind=j(1))
+      else if (i == 2) then
+        write(s, '(2F4.1,2F4.0)') real(-9.49999905,kind=j(2)), &
+                                  real(9.49999905,kind=j(2)),  &
+                                  real(9.5,kind=j(2)), real(8.5,kind=j(2))
+      else if (i == 3) then
+        write(s, '(2F4.1,2F4.0)') real(-9.49999905,kind=j(3)), &
+                                  real(9.49999905,kind=j(3)),  &
+                                  real(9.5,kind=j(3)), real(8.5,kind=j(3))
+      else if (i == 4) then
+        write(s, '(2F4.1,2F4.0)') real(-9.49999905,kind=j(4)), &
+                                  real(9.49999905,kind=j(4)),  &
+                                  real(9.5,kind=j(4)), real(8.5,kind=j(4))
+      end if
+      if (s /= '-9.5 9.5 10.  8.') then
+        l_skip(i) = .true.
+        print "('Unsupported rounding for real(',i0,')')", j(i)
+      end if
+    end do
+        

 ! Original test.
     call checkfmt("(en15.2)", -.44444,    "    -444.44E-03")
@@ -109,18 +141,18 @@ implicit none

     !print *, n_tst, n_cnt
     if (n_cnt /= 0) call abort
+    if (all(.not. l_skip)) write (10, *) "All kinds rounded to nearest"
+    close (10)

 contains
     subroutine checkfmt(fmt, x, cmp)
-        use ISO_FORTRAN_ENV
         implicit none
-        integer, parameter :: j(size(real_kinds)+4)=[REAL_KINDS, [4, 4, 4, 4]]
         integer :: i
         character(len=*), intent(in) :: fmt
         real, intent(in) :: x
         character(len=*), intent(in) :: cmp
-        character(len=20) :: s
         do i=1,size(real_kinds)
+          if (l_skip(i)) cycle
           if (i == 1) then
             write(s, fmt) real(x,kind=j(1))
           else if (i == 2) then
@@ -139,3 +171,5 @@ contains

     end subroutine
 end program
+! { dg-final { scan-file fmt_en.res "All kinds rounded to nearest" { xfail
i?86-*-solaris2.9* } } }
+! { dg-final { cleanup-saved-temps } }

the gfortran.sum contains

...
PASS: gfortran.dg/fmt_en.f90  -O0   scan-file All kinds rounded to nearest
...


  parent reply	other threads:[~2014-03-20 17:30 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-10  1:08 [Bug fortran/60128] New: " walt.brainerd at gmail dot com
2014-02-10  7:41 ` [Bug fortran/60128] [4.8/4.9 Regression] " dominiq at lps dot ens.fr
2014-02-10  9:52 ` dominiq at lps dot ens.fr
2014-02-10 10:15 ` dominiq at lps dot ens.fr
2014-02-10 11:36 ` dominiq at lps dot ens.fr
2014-02-16 20:49 ` dominiq at lps dot ens.fr
2014-02-17 14:44 ` dominiq at lps dot ens.fr
2014-02-18 10:51 ` dominiq at lps dot ens.fr
2014-02-24  9:33 ` rguenth at gcc dot gnu.org
2014-03-01 23:20 ` burnus at gcc dot gnu.org
2014-03-02  0:01 ` jvdelisle at gcc dot gnu.org
2014-03-08  6:05 ` jvdelisle at gcc dot gnu.org
2014-03-16  0:18 ` jvdelisle at gcc dot gnu.org
2014-03-16  0:35 ` jvdelisle at gcc dot gnu.org
2014-03-16  0:38 ` jvdelisle at gcc dot gnu.org
2014-03-18 10:27 ` ro at gcc dot gnu.org
2014-03-18 10:59 ` dominiq at lps dot ens.fr
2014-03-18 11:04 ` ro at CeBiTec dot Uni-Bielefeld.DE
2014-03-18 11:07 ` dominiq at lps dot ens.fr
2014-03-18 12:09 ` ro at CeBiTec dot Uni-Bielefeld.DE
2014-03-18 12:31 ` dominiq at lps dot ens.fr
2014-03-18 13:16 ` jvdelisle at gcc dot gnu.org
2014-03-18 13:23 ` ro at CeBiTec dot Uni-Bielefeld.DE
2014-03-18 13:26 ` dominiq at lps dot ens.fr
2014-03-18 17:11 ` dominiq at lps dot ens.fr
2014-03-19  1:41 ` jvdelisle at gcc dot gnu.org
2014-03-19  9:30 ` ro at CeBiTec dot Uni-Bielefeld.DE
2014-03-19  9:32 ` ro at CeBiTec dot Uni-Bielefeld.DE
2014-03-20 11:04 ` dominiq at lps dot ens.fr
2014-03-20 12:47 ` ro at CeBiTec dot Uni-Bielefeld.DE
2014-03-20 15:36 ` dominiq at lps dot ens.fr
2014-03-20 15:43 ` ro at CeBiTec dot Uni-Bielefeld.DE
2014-03-20 15:49 ` dominiq at lps dot ens.fr
2014-03-20 15:53 ` ro at CeBiTec dot Uni-Bielefeld.DE
2014-03-20 17:30 ` dominiq at lps dot ens.fr [this message]
2014-03-21 10:12 ` ro at CeBiTec dot Uni-Bielefeld.DE
2014-03-24  0:25 ` jvdelisle at gcc dot gnu.org
2014-03-24  0:30 ` jvdelisle at gcc dot gnu.org
2014-03-25 14:40 ` danglin at gcc dot gnu.org
2014-03-25 15:15 ` dominiq at lps dot ens.fr
2014-03-26  1:29 ` dave.anglin at bell dot net
2014-03-26 12:24 ` dave.anglin at bell dot net
2014-03-26 12:51 ` dominiq at lps dot ens.fr
2014-03-26 14:14 ` dave.anglin at bell dot net
2014-03-26 15:09 ` dominiq at lps dot ens.fr
2014-03-26 15:26 ` dave.anglin at bell dot net
2014-03-26 16:34 ` dominiq at lps dot ens.fr
2014-03-26 18:07 ` dominiq at lps dot ens.fr
2014-03-26 19:43 ` dave.anglin at bell dot net
2014-03-26 19:57 ` dave.anglin at bell dot net
2014-03-26 20:20 ` dominiq at lps dot ens.fr
2014-03-26 20:41 ` dave.anglin at bell dot net
2014-03-27 15:00 ` dominiq at lps dot ens.fr
2014-03-27 15:39 ` ro at CeBiTec dot Uni-Bielefeld.DE
2014-03-27 16:04 ` dave.anglin at bell dot net
2014-03-27 22:31 ` dominiq at lps dot ens.fr
2014-03-28  1:03 ` jvdelisle at gcc dot gnu.org
2014-03-28  1:05 ` dave.anglin at bell dot net
2014-03-29 16:12 ` dominiq at lps dot ens.fr
2014-03-29 19:00 ` dave.anglin at bell dot net
2014-03-29 23:30 ` dominiq at lps dot ens.fr
2014-03-29 23:52 ` dave.anglin at bell dot net
2014-03-31 11:28 ` ro at CeBiTec dot Uni-Bielefeld.DE
2014-04-01 13:32 ` [Bug fortran/60128] [4.8 " dominiq at lps dot ens.fr
2014-04-04  6:51 ` dominiq at lps dot ens.fr

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-60128-4-JFUvZB1OQ9@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).