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, 27 Mar 2014 15:00:00 -0000	[thread overview]
Message-ID: <bug-60128-4-c3arClbMCG@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 #53 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Dave, Rainer,

Could you test the following code?


[karma] f90/bug% cat fmt_en_1.f90
! { dg-do run }
! PR60128 Invalid outputs with EN descriptors
! Test case provided by Walt Brainerd.
program pr60128
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, '(2(1PE9.1))') real(9950.0,kind=j(1)), &
                                real(9750.0,kind=j(1))
      else if (i == 2) then
        write(s, '(2(1PE9.1))') real(9950.0,kind=j(2)), &
                                real(9750.0,kind=j(2))
      else if (i == 3) then
        write(s, '(2(1PE9.1))') real(9950.0,kind=j(3)), &
                                real(9750.0,kind=j(3))
      else if (i == 4) then
        write(s, '(2(1PE9.1))') real(9950.0,kind=j(4)), &
                                real(9750.0,kind=j(4))
      end if
      if (s /= '  1.0E+04  9.8E+03') then
        l_skip(i) = .true.
        print "('Unsupported rounding for real(',i0,')')", j(i)
        write (10, "('Unsupported rounding for real(',i0,')')") j(i)
      end if
    end do

    call checkfmt("(en15.0)", 9500.0,     "        10.E+03")
    call checkfmt("(en15.1)", 9950.0,     "       10.0E+03")
    call checkfmt("(en15.0)", -9500.0,     "       -10.E+03")
    call checkfmt("(en15.1)", -9950.0,     "      -10.0E+03")
    call checkfmt("(en15.1)", 987350.,     "      987.4E+03")
    call checkfmt("(en15.2)", 98765.,      "      98.76E+03")
    call checkfmt("(en15.1)", -987350.,     "     -987.4E+03")
    call checkfmt("(en15.2)", -98765.,      "     -98.76E+03")

    print *, n_tst, n_cnt
    if (n_cnt /= 0) call abort

contains
    subroutine checkfmt(fmt, x, cmp)
        implicit none
        integer :: i
        character(len=*), intent(in) :: fmt
        real, intent(in) :: x
        character(len=*), intent(in) :: cmp
        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
            write(s, fmt) real(x,kind=j(2))
          else if (i == 3) then
            write(s, fmt) real(x,kind=j(3))
          else if (i == 4) then
            write(s, fmt) real(x,kind=j(4))
          end if
          n_tst = n_tst + 1
          if (s /= cmp) then
             print "(a,1x,a,' expected: ',1x,a)", fmt, s, cmp
             n_cnt = n_cnt + 1
           end if
        end do

    end subroutine
end program
! { dg-final { scan-file-not fmt_en.res "Unsupported rounding" { xfail {
i?86-*-solaris2.9* hppa*-*-hpux11* } } } }
! { dg-final { cleanup-saved-temps } }


  parent reply	other threads:[~2014-03-27 15:00 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
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 [this message]
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-c3arClbMCG@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).