public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/105372] New: The result of the merge function is different when it's type of parameters  is the extensions type of derived type
@ 2022-04-25  0:57 xudong.luo@compiler-dev.com
  2022-04-25  7:03 ` [Bug fortran/105372] " schwab@linux-m68k.org
  0 siblings, 1 reply; 2+ messages in thread
From: xudong.luo@compiler-dev.com @ 2022-04-25  0:57 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105372
           Summary: The result of the merge function is different when
                    it's type of parameters  is the extensions type of
                    derived type
           Product: gcc
           Version: 11.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: xudong.luo@compiler-dev.com
  Target Milestone: ---

Whether the mask is a constant or a variable causes inconsistent results of the
merge function when it's type of parameters  is the extensions type of derived
type.
1.The mask is constant
Program test00
  Type t
    Integer :: c
  End Type
  Type,Extends(t) :: t2
    Integer :: c2
  End Type
  Class(t),Allocatable :: x,y,r
  logical :: ok = .true.
  x = t2(1,-1)
  y = t2(2,-2)
  r = merge (x,y,.true.)
  Select Type (z=>r)
  Type Is (t)
    print *,z%c
  Type Is (t2)
    print *,z%c,z%c2
  End Select
End Program
2. The mask is variable
Program test01
  Type t
    Integer :: c
  End Type
  Type,Extends(t) :: t2
    Integer :: c2
  End Type
  Class(t),Allocatable :: x,y,r
  logical :: ok = .true.
  integer :: i = 1
  x = t2(1,-1)
  y = t2(2,-2)
  r = merge (x,y,i == 1)
  Select Type (z=>r)
  Type Is (t)
    print *,z%c
  Type Is (t2)
    print *,z%c,z%c2
  End Select
End Program

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

end of thread, other threads:[~2022-04-25  7:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-25  0:57 [Bug fortran/105372] New: The result of the merge function is different when it's type of parameters is the extensions type of derived type xudong.luo@compiler-dev.com
2022-04-25  7:03 ` [Bug fortran/105372] " schwab@linux-m68k.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).