public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/114618] New: Format produces incorrect output when contains 1x, ok when uses " "
@ 2024-04-06  3:05 urbanjost at comcast dot net
  2024-04-06  9:11 ` [Bug libfortran/114618] " anlauf at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: urbanjost at comcast dot net @ 2024-04-06  3:05 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114618
           Summary: Format produces incorrect output when contains 1x, ok
                    when uses " "
           Product: gcc
           Version: 13.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: urbanjost at comcast dot net
  Target Milestone: ---

The format gen2 does what I would expect the format gen1 does,
but get very strange output when use 1x (in gen1)  instead of space character
(in gen2).

program tryit
   implicit none
   integer, parameter :: wp = kind(0d0)
   real(kind=wp) :: pi  =
3.14159265358979323846264338327950288419716939937510582097494459230_wp
   character(len=*), parameter:: gen1 = '(19("."),t1,g0,1x,t21,g0)'
   character(len=*), parameter:: gen2 = '(19("."),t1,g0," ",t21,g0)'
   character(len=:), allocatable :: fmt
   integer :: i, j
   do i=1,2
      select case(i)
      case(1); fmt=gen1
      case(2); fmt=gen2
      end select
      do j=1,2
         write (*, fmt) 'PI', pi
         write (*, fmt) 'REAL(PI)', real(pi)
         write (*, fmt) 'DBLE(PI)', dble(pi)
         write (*, fmt) 'RADIX', radix(pi)
         write (*, fmt) 'RANGE', range(pi)
         write (*, fmt) 'PRECISION', precision(pi)
         write (*,'(80("-"))')
      enddo
   enddo
end program tryit

PI.................^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@ 3.1415926535897931
REAL(PI)...........^@^@^@^@^@^@^@^@^@^@^@ 3.14159274
DBLE(PI)...........^@^@^@^@^@^@^@^@^@^@^@ 3.1415926535897931
RADIX..............^@^@^@^@^@^@^@^@^@^@^@ 3. 2
RANGE..............^@^@^@^@^@^@^@^@^@^@^@ 3. 307
PRECISION..........^@^@^@^@^@^@^@^@^@^@ 15
--------------------------------------------------------------------------------
PI.................----------------- 3.1415926535897931
REAL(PI)...........----------- 3.14159274
DBLE(PI)...........----------- 3.1415926535897931
RADIX..............----------- 3. 2
RANGE..............----------- 3. 307
PRECISION..........---------- 15
--------------------------------------------------------------------------------
PI ................ 3.1415926535897931
REAL(PI) .......... 3.14159274
DBLE(PI) .......... 3.1415926535897931
RADIX ............. 2
RANGE ............. 307
PRECISION ......... 15
--------------------------------------------------------------------------------
PI ................ 3.1415926535897931
REAL(PI) .......... 3.14159274
DBLE(PI) .......... 3.1415926535897931
RADIX ............. 2
RANGE ............. 307
PRECISION ......... 15
--------------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-04-16 22:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-06  3:05 [Bug fortran/114618] New: Format produces incorrect output when contains 1x, ok when uses " " urbanjost at comcast dot net
2024-04-06  9:11 ` [Bug libfortran/114618] " anlauf at gcc dot gnu.org
2024-04-06 13:59 ` jvdelisle at gcc dot gnu.org
2024-04-07 18:47 ` jvdelisle at gcc dot gnu.org
2024-04-14  0:17 ` jvdelisle at gcc dot gnu.org
2024-04-14 18:14 ` jvdelisle at gcc dot gnu.org
2024-04-14 18:18 ` jvdelisle at gcc dot gnu.org
2024-04-16 22:17 ` jvdelisle at gcc dot gnu.org

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