[Bug fortran/34306] New: misprinting of derived types

dominiq at lps dot ens dot fr gcc-bugzilla@gcc.gnu.org
Fri Nov 30 23:40:00 GMT 2007


While looking at PR18022, I stumbled over the following problem illustrated by
the reduced code from the original one:

program test_bug

  implicit none

  character(len=2), dimension(4,2) :: tab_c
  character(len=30) :: buf1, buf2

  type :: point
     character(len=2) :: x,y
  end type point
  type(point), dimension(4) :: pts

  tab_c(:,1)(:) = (/'1','2','3','4'/)
  tab_c(:,2)(:) = (/'2','3','4','5'/)

  pts%x =  tab_c(:,1)
  pts%y =  tab_c(:,2)

  if (any(pts%x /= tab_c(:,1)) .or. any(pts%y /= tab_c(:,2))) call abort()

  write (buf1, *) pts
  write (buf2, *) tab_c

  print *, buf1
  print *, buf2

  if (buf1 /= buf2) call abort()

end program test_bug

which gives

  1 2 2 3 3 4 4 5              
  1 2 3 4 2 3 4 5              
Abort


-- 
           Summary: misprinting of derived types
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dominiq at lps dot ens dot fr
 GCC build triplet: i686-apple-darwin9
  GCC host triplet: i686-apple-darwin9
GCC target triplet: i686-apple-darwin9


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



More information about the Gcc-bugs mailing list