https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98454
Bug ID: 98454
Summary: Apparent wrong initialization in function result
Product: gcc
Version: 9.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: fmartinez at gmv dot com
Target Milestone: ---
Created attachment 49845
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49845&action=edit
Module with type implmentation and test driver
Good morning.
The components of a derived type seem to be wrongly initialized when they type
is the output of a function (see code attached).
I would expect that any declaration of the type
type(t_test) :: x
would lead to all components initialized with the values explicitly provided in
the type declaration. It seem not to be the case in the attached example.
Before constructor
unit = -1
default = 0
trace = T
def trace = F
After constructor
unit = -1230083984
default = 21901
trace = T
def trace = F
I have tried with Intel 19.1 and it provides the expected behaviour.
Before constructor
unit = -1
default = 0
trace = T
def trace = F
After constructor
unit = -1
default = 0
trace = T
def trace = F
The same behaviour is observed in gfortran 11
Best regards,
Fran