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

            Bug ID: 83823
           Summary: [8 Regression] Character length issues with PACK()
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: anlauf at gmx dot de
  Target Milestone: ---

The following code gives wrong output with 8.0 svn rev.256556:

program gfcbug145
  implicit none
  type t_obstyp
    character(len=8) :: name
  end type t_obstyp
  type (t_obstyp) ,parameter :: obstyp(*)= &
     [ t_obstyp ('SYNOP' ), &
       t_obstyp ('DRIBU' ), &
       t_obstyp ('TEMP'  ), &
       t_obstyp ('RADAR' )  ]
  logical :: mask(size(obstyp)) = .true.

  print *,                        obstyp% name
  print *,                  pack (obstyp% name, mask)
  write(6,'(20(a8,:,"|"))')       obstyp% name
  write(6,'(20(a8,:,"|"))') pack (obstyp% name, mask)
end program gfcbug145


Bad output with 8.0:

 SYNOP   DRIBU   TEMP    RADAR   
 SYNOPDRIBUTEMPRRADAR
SYNOP   |DRIBU   |TEMP    |RADAR   
   SYNOP|   DRIBU|   TEMPR|   RADAR

Good output with 7.2:
 SYNOP   DRIBU   TEMP    RADAR   
 SYNOP   DRIBU   TEMP    RADAR   
SYNOP   |DRIBU   |TEMP    |RADAR   
SYNOP   |DRIBU   |TEMP    |RADAR   


Note also the bogus 'R' after "TEMP".

Reply via email to