public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/59202] Erroneous argument aliasing with defined assignment
       [not found] <bug-59202-4@http.gcc.gnu.org/bugzilla/>
@ 2014-03-22 15:41 ` dominiq at lps dot ens.fr
  2021-06-01 15:38 ` vladimir.fuka at gmail dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-03-22 15:41 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59202

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-03-22
     Ever confirmed|0                           |1

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Behavior still present at r208765.


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

* [Bug fortran/59202] Erroneous argument aliasing with defined assignment
       [not found] <bug-59202-4@http.gcc.gnu.org/bugzilla/>
  2014-03-22 15:41 ` [Bug fortran/59202] Erroneous argument aliasing with defined assignment dominiq at lps dot ens.fr
@ 2021-06-01 15:38 ` vladimir.fuka at gmail dot com
  2021-06-03  8:34 ` federico.perini at gmail dot com
  2021-06-03  8:35 ` federico.perini at gmail dot com
  3 siblings, 0 replies; 4+ messages in thread
From: vladimir.fuka at gmail dot com @ 2021-06-01 15:38 UTC (permalink / raw)
  To: gcc-bugs

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

Vladimir Fuka <vladimir.fuka at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vladimir.fuka at gmail dot com

--- Comment #2 from Vladimir Fuka <vladimir.fuka at gmail dot com> ---
Behaviour still present in GCC 11.

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

* [Bug fortran/59202] Erroneous argument aliasing with defined assignment
       [not found] <bug-59202-4@http.gcc.gnu.org/bugzilla/>
  2014-03-22 15:41 ` [Bug fortran/59202] Erroneous argument aliasing with defined assignment dominiq at lps dot ens.fr
  2021-06-01 15:38 ` vladimir.fuka at gmail dot com
@ 2021-06-03  8:34 ` federico.perini at gmail dot com
  2021-06-03  8:35 ` federico.perini at gmail dot com
  3 siblings, 0 replies; 4+ messages in thread
From: federico.perini at gmail dot com @ 2021-06-03  8:34 UTC (permalink / raw)
  To: gcc-bugs

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

federico <federico.perini at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |federico.perini at gmail dot com

--- Comment #3 from federico <federico.perini at gmail dot com> ---
Created attachment 50918
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50918&action=edit
test program for self-assignment with derived type

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

* [Bug fortran/59202] Erroneous argument aliasing with defined assignment
       [not found] <bug-59202-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2021-06-03  8:34 ` federico.perini at gmail dot com
@ 2021-06-03  8:35 ` federico.perini at gmail dot com
  3 siblings, 0 replies; 4+ messages in thread
From: federico.perini at gmail dot com @ 2021-06-03  8:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from federico <federico.perini at gmail dot com> ---
The self-assignment issue is present even if the derived type has no
allocatable components. Here is a sample test program that gives an error with
gfortran 10.2.0: 

module assign
        implicit none
        private


        type, public :: t
             integer :: a              
             contains
                   procedure :: destroy=>t_destroy
                   procedure :: assign=>t_assign
                   generic :: assignment(=) =>assign 
        end type t

   contains


   elemental subroutine t_destroy(this)
        class(t), intent(inout) :: this
        this%a = 0
   end subroutine t_destroy

   subroutine t_assign(this,that)
        class(t), intent(inout) :: this
        class(t), intent(in) :: that

        call this%destroy() ! Clean memory first

        select type (thatPtr=>that)
           type is (t)
               this%a = thatPtr%a    
        end select

   end subroutine t_assign
end module assign

program test
        use assign
        type(t), allocatable :: t1(:)

        allocate(t1(10))

        do i=1,10
          t1(i)%a = i
        end do  

        n = 0
        do i=1,10
          if (mod(i,2)/=0) then 
              n = n + 1
              t1(n) = t1(i)
              print *, 'i=',i,' t(i)%a=',t1(i)%a,' expected t(i)%a=',i,':
',merge('ERROR!','OK    ',t1(i)%a/=i)
          endif
        end do

end program test

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

end of thread, other threads:[~2021-06-03  8:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-59202-4@http.gcc.gnu.org/bugzilla/>
2014-03-22 15:41 ` [Bug fortran/59202] Erroneous argument aliasing with defined assignment dominiq at lps dot ens.fr
2021-06-01 15:38 ` vladimir.fuka at gmail dot com
2021-06-03  8:34 ` federico.perini at gmail dot com
2021-06-03  8:35 ` federico.perini at gmail dot com

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).