https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82859
Bug ID: 82859
Summary: derived type character component, array comparison
inconsistent
Product: gcc
Version: 7.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: simon.kluepfel at gmail dot com
Target Milestone: ---
Created attachment 42547
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42547&action=edit
source code of test program
Inconsistency occurs when comparing arrays of derived types containing
character components. Success/Failure seems to depend on blank padding in
initialization of the array.
In the snippet from the attached program, A1 and A2 behave differently.
[...]
INTEGER, PARAMETER :: MLEN=2
TYPE A
CHARACTER(LEN=MLEN) :: STR
END TYPE A
TYPE(A), DIMENSION(*), PARAMETER :: A1= (/ &
A("AX") &
, A("B ") &
, A("C ") &
/)
TYPE(A), DIMENSION(*), PARAMETER :: A2= (/ &
A("AX") &
, A("B") &
, A("C") &
/)
[...]
The attached program should give the same results for all cases in both of the
test sets. Results with gfortran 7.1.1 and 6.3.0 are unexpected, marked with
arrows below.
A1 /A2 T T T
SAP/SAA T T T
SAP/A1 T T T
SAA/A1 T T T
SAP/A2 T T T
SAA/A2 T F F <--
A1 /SP F T F
A2 /SP F F F <--
SAP/SP F T F
SAA/SP F T F
A1 /SA F T F
A2 /SA F F F <--
SAP/SA F T F
SAA/SA F T F