https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109209
Bug ID: 109209
Summary: [13.0 regression] erroneous error on assignment of
alloctables
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: juergen.reuter at desy dot de
Target Milestone: ---
Some commit between last week and now, so between March 12 and March 19, has
created a regression, so gfortran throws a (presumably wrong) error message:
resonances_sub.f90:816:4:
816 | history_new(1:s) = res_set%history(1:s)
| 1
Error: Component to the right of a part reference with nonzero rank must not
have the ALLOCATABLE attribute at (1)
resonances_sub.f90:816:23:
816 | history_new(1:s) = res_set%history(1:s)
| 1
Error: Component to the right of a part reference with nonzero rank must not
have the ALLOCATABLE attribute at (1)
This is a first part of the code below, I will hopefully provide a full
reproducer later one.
810 module subroutine resonance_history_set_expand (res_set)
811 class(resonance_history_set_t), intent(inout) :: res_set
812 type(resonance_history_t), dimension(:), allocatable :: history_new
813 integer :: s
814 s = size (res_set%history)
815 allocate (history_new (2 * s))
816 history_new(1:s) = res_set%history(1:s)
817 call move_alloc (history_new, res_set%history)
818 end subroutine resonance_history_set_expand
58 type :: resonance_info_t
59 type(flavor_t) :: flavor
60 type(resonance_contributors_t) :: contributors
61 contains
62 procedure :: copy => resonance_info_copy
63 procedure :: write => resonance_info_write
64 procedure, private :: resonance_info_init_pdg
65 procedure, private :: resonance_info_init_flv
66 generic :: init => resonance_info_init_pdg,
resonance_info_init_flv
67 procedure, private :: resonance_info_equal
68 generic :: operator(==) => resonance_info_equal
69 procedure :: mapping => resonance_info_mapping
70 procedure, private :: get_n_contributors =>
resonance_info_get_n_contributors
71 procedure, private :: contains => resonance_info_contains
72 procedure :: evaluate_distance => resonance_info_evaluate_distance
73 procedure :: evaluate_gaussian => resonance_info_evaluate_gaussian
74 procedure :: is_on_shell => resonance_info_is_on_shell
75 procedure :: as_omega_string => resonance_info_as_omega_string
76 end type resonance_info_t
77
78 type :: resonance_history_t
79 type(resonance_info_t), dimension(:), allocatable :: resonances
80 integer :: n_resonances = 0
81 contains
82 procedure :: clear => resonance_history_clear
83 procedure :: copy => resonance_history_copy
84 procedure :: write => resonance_history_write
85 procedure, private :: resonance_history_assign
86 generic :: assignment(=) => resonance_history_assign
87 procedure, private :: resonance_history_equal
88 generic :: operator(==) => resonance_history_equal
89 procedure, private :: resonance_history_contains
90 generic :: operator(.contains.) => resonance_history_contains
91 procedure :: add_resonance => resonance_history_add_resonance
92 procedure :: remove_resonance =>
resonance_history_remove_resonance
93 procedure :: add_offset => resonance_history_add_offset
94 procedure :: contains_leg => resonance_history_contains_leg
95 procedure :: mapping => resonance_history_mapping
96 procedure :: only_has_n_contributors => &
97 resonance_history_only_has_n_contributors
98 procedure :: has_flavor => resonance_history_has_flavor
99 procedure :: evaluate_distances =>
resonance_history_evaluate_distances
100 procedure :: evaluate_gaussian =>
resonance_history_evaluate_gaussian
101 procedure :: is_on_shell => resonance_history_is_on_shell
102 procedure :: as_omega_string => resonance_history_as_omega_string
103 procedure :: to_tree => resonance_history_to_tree
104 end type resonance_history_t
129 type :: resonance_history_set_t
130 private
131 logical :: complete = .false.
132 integer :: n_filter = 0
133 type(resonance_history_t), dimension(:), allocatable :: history
134 type(index_array_t), dimension(:), allocatable :: contains_this
135 type(resonance_tree_t), dimension(:), allocatable :: tree
136 integer :: last = 0
137 contains
138 procedure :: write => resonance_history_set_write
139 procedure :: init => resonance_history_set_init
140 procedure :: enter => resonance_history_set_enter
141 procedure :: freeze => resonance_history_set_freeze
142 procedure :: determine_on_shell_histories &
143 => resonance_history_set_determine_on_shell_histories
144 procedure :: evaluate_gaussian =>
resonance_history_set_evaluate_gaussian
145 procedure :: get_n_history => resonance_history_set_get_n_history
146 procedure :: get_history => resonance_history_set_get_history
147 procedure :: to_array => resonance_history_set_to_array
148 procedure :: get_tree => resonance_history_set_get_tree
149 procedure, private :: expand => resonance_history_set_expand
150 end type resonance_history_set_t