public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "john.harper at vuw dot ac.nz" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libfortran/111022] ES0.0E0 format gave ES0.dE0 output with d too high.
Date: Sun, 27 Aug 2023 21:40:58 +0000	[thread overview]
Message-ID: <bug-111022-4-on6FiJiuJg@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-111022-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #11 from john.harper at vuw dot ac.nz ---
Jerry's test program is identical with mine. 
Because E format is supposed to give no digits before the decimal point 
except possibly a leading zero, E0.0 and E0.0E0 are both pointless, and 
Steve Lionel pointed out in Fortran Discourse that the standard forbids 
them because they would generate an illegal value of k for the kP edit
descriptor (which happens not to be explicitly used here.) So I think
gfortran ought to give a run-time error for it. If I compiled the program 
with ifort and more warning options, the first 2 write statements gave

real kinds 4 8 16 16
With (A,1X, E0.0E0)  *****************************************
forrtl: error (63): output conversion error, unit 6, file /dev/pts/1

The ES result from gfortran was correct and standard-conforming. The EN
one should have said 666.E+0 not 666.

  On Sun, 27 Aug 2023, jvdelisle at gcc dot gnu.org wrote:

> Date: Sun, 27 Aug 2023 15:38:33 +0000
> From: jvdelisle at gcc dot gnu.org <gcc-bugzilla@gcc.gnu.org>
> To: John Harper <john.harper@vuw.ac.nz>
> Subject: [Bug libfortran/111022] ES0.0E0 format gave ES0.dE0 output with d too
>      high.
> Resent-Date: Mon, 28 Aug 2023 03:38:51 +1200 (NZST)
> Resent-From: <john.harper@vuw.ac.nz>
> 
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111022
>
> --- Comment #9 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
> I am using this:
>
> program teste0es0en0
>  integer,parameter::p1 = kind(1e0), p2 = kind(1d0), &
>       p3 = selected_real_kind(precision(1.0_p2)+1), &
>       hp = selected_real_kind(precision(1.0_p3)+1), &
>       p4 = merge(hp,p3,hp>0) ! in gfortran p4 /= p3, in ifort p4 == p3
>  character(*),parameter:: fmt(3) = "(A,1X,"//[" E","ES","EN"]//"0.0E0) "
>  integer ifmt
>  write(*,"(A,4(1X,I0))") 'real kinds',p1,p2,p3,p4
>  do ifmt = 1,3
>     write(*, fmt(ifmt)) 'With '//fmt(ifmt), 666.0_p1
>     write(*, fmt(ifmt)) 'With '//fmt(ifmt), 666.0_p2
>     write(*, fmt(ifmt)) 'With '//fmt(ifmt), 666.0_p3
>     if(p3/=p4) write(*, fmt(ifmt)) 'With '//fmt(ifmt), 666.0_p4
>  end do
> end program teste0es0en0
>
> And I get the following output with some test patching:
>
> $ ./a.out
> real kinds 4 8 10 16
> With (A,1X, E0.0E0)  1.E+3
> With (A,1X, E0.0E0)  1.E+3
> With (A,1X, E0.0E0)  1.E+3
> With (A,1X, E0.0E0)  1.E+3
> With (A,1X,ES0.0E0)  7.E+2
> With (A,1X,ES0.0E0)  7.E+2
> With (A,1X,ES0.0E0)  7.E+2
> With (A,1X,ES0.0E0)  7.E+2
> With (A,1X,EN0.0E0)  666.
> With (A,1X,EN0.0E0)  666.
> With (A,1X,EN0.0E0)  666.
> With (A,1X,EN0.0E0)  666.
>
> -- 
> You are receiving this mail because:
> You reported the bug.
>


-- John Harper, School of Mathematics and Statistics
Victoria Univ. of Wellington, PO Box 600, Wellington 6140, New Zealand.
e-mail john.harper@vuw.ac.nz

  parent reply	other threads:[~2023-08-27 21:40 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-15  4:41 [Bug fortran/111022] New: " john.harper at vuw dot ac.nz
2023-08-15 19:45 ` [Bug libfortran/111022] " anlauf at gcc dot gnu.org
2023-08-15 23:49 ` john.harper at vuw dot ac.nz
2023-08-16  0:15 ` jvdelisle at gcc dot gnu.org
2023-08-16  3:39 ` jvdelisle at gcc dot gnu.org
2023-08-23  5:46 ` john.harper at vuw dot ac.nz
2023-08-25  0:48 ` jvdelisle at gcc dot gnu.org
2023-08-26  4:26 ` jvdelisle at gcc dot gnu.org
2023-08-26  5:40 ` john.harper at vuw dot ac.nz
2023-08-27 15:38 ` jvdelisle at gcc dot gnu.org
2023-08-27 19:41 ` anlauf at gcc dot gnu.org
2023-08-27 21:40 ` john.harper at vuw dot ac.nz [this message]
2023-08-27 22:17 ` jvdelisle at gcc dot gnu.org
2023-08-28  1:26 ` john.harper at vuw dot ac.nz
2023-08-28  1:44 ` john.harper at vuw dot ac.nz
2023-08-29 23:45 ` john.harper at vuw dot ac.nz
2023-08-30  0:30 ` jvdelisle at gcc dot gnu.org
2023-09-03 16:20 ` jvdelisle at gcc dot gnu.org
2023-09-04 17:12 ` jvdelisle at gcc dot gnu.org
2023-09-04 18:38 ` anlauf at gcc dot gnu.org
2023-09-04 22:32 ` john.harper at vuw dot ac.nz
2023-09-05  2:57 ` jvdelisle at gcc dot gnu.org
2023-10-15  2:12 ` jvdelisle at gcc dot gnu.org
2023-10-15  7:03 ` john.harper at vuw dot ac.nz
2024-01-25 22:21 ` jvdelisle at gcc dot gnu.org
2024-01-26  5:24 ` john.harper at vuw dot ac.nz
2024-01-26 18:29 ` anlauf at gcc dot gnu.org
2024-01-26 18:50 ` jvdelisle at gcc dot gnu.org
2024-01-30 13:19 ` jvdelisle at gcc dot gnu.org
2024-02-03 17:33 ` cvs-commit at gcc dot gnu.org
2024-02-11 22:19 ` nightstrike at gmail dot com
2024-02-11 22:21 ` anlauf at gcc dot gnu.org
2024-02-11 22:25 ` nightstrike at gmail dot com
2024-02-11 22:30 ` nightstrike at gmail dot com
2024-02-11 22:58 ` anlauf at gcc dot gnu.org
2024-02-12  2:40 ` nightstrike at gmail dot com
2024-02-12 20:12 ` jvdelisle at gcc dot gnu.org
2024-02-13  0:42 ` cvs-commit at gcc dot gnu.org
2024-02-13  0:43 ` jvdelisle 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-111022-4-on6FiJiuJg@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).