public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/98454] New: Apparent wrong initialization in function result
@ 2020-12-27 13:28 fmartinez at gmv dot com
  2020-12-27 19:54 ` [Bug fortran/98454] " kargl at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: fmartinez at gmv dot com @ 2020-12-27 13:28 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-12-28 15:19 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-27 13:28 [Bug fortran/98454] New: Apparent wrong initialization in function result fmartinez at gmv dot com
2020-12-27 19:54 ` [Bug fortran/98454] " kargl at gcc dot gnu.org
2020-12-27 21:25 ` anlauf at gcc dot gnu.org
2020-12-27 21:44 ` anlauf at gcc dot gnu.org
2020-12-27 21:59 ` kargl at gcc dot gnu.org
2020-12-27 22:01 ` anlauf at gcc dot gnu.org
2020-12-27 22:15 ` ffadrique at gmail dot com
2020-12-27 22:18 ` ffadrique at gmail dot com
2020-12-27 23:07 ` sgk at troutmask dot apl.washington.edu
2020-12-28  8:46 ` mscfd at gmx dot net
2020-12-28  9:47 ` anlauf at gcc dot gnu.org
2020-12-28 15:19 ` anlauf at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).