public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/67171] New: [6.0 regression] sourced allocation
@ 2015-08-10 12:03 mexas at bristol dot ac.uk
  2015-08-10 12:16 ` [Bug fortran/67171] " vehre at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: mexas at bristol dot ac.uk @ 2015-08-10 12:03 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 67171
           Summary: [6.0 regression] sourced allocation
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mexas at bristol dot ac.uk
                CC: vehre at gcc dot gnu.org
  Target Milestone: ---

program z
implicit none

real, allocatable :: d(:,:), tmp(:,:)
integer :: i, errstat

allocate( d( 100, 2 ), source = 0.0, stat=errstat )

d(:,1) = (/ ( real(i), i=1,100) /)
d(:,2) = (/ ( real(2*i), i=1,100) /)

write (*,*) d( 1, :) 
call move_alloc( from=d, to=tmp )
write (*,*) tmp( 1, :) 
allocate( d( 50, 2 ), source = tmp(1:50,:) , stat=errstat )
write (*,*) d( 1, :) 
deallocate( tmp )

end program z 

Correct output in gfortran 5:

$ gfortran5 -Wl,-rpath=/usr/local/lib/gcc5 z.f90
$ ./a.out 
   1.00000000       2.00000000    
   1.00000000       2.00000000    
   1.00000000       2.00000000    

Wrong output in gfortran 6:

$ gfortran6 -Wl,-rpath=/usr/local/lib/gcc6 z.f90 
$ ./a.out 
   1.00000000       2.00000000    
   1.00000000       2.00000000    
   4.00000000       0.00000000    

This is on FreeBSD 10.1-RELEASE-p16 amd64


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

end of thread, other threads:[~2015-10-25 21:36 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-10 12:03 [Bug fortran/67171] New: [6.0 regression] sourced allocation mexas at bristol dot ac.uk
2015-08-10 12:16 ` [Bug fortran/67171] " vehre at gcc dot gnu.org
2015-08-10 13:04 ` dominiq at lps dot ens.fr
2015-08-11  8:49 ` [Bug fortran/67171] [6 " rguenth at gcc dot gnu.org
2015-10-16  8:34 ` rguenth at gcc dot gnu.org
2015-10-20 14:13 ` pault at gcc dot gnu.org
2015-10-20 14:23 ` vehre at gmx dot de
2015-10-20 18:35 ` pault at gcc dot gnu.org
2015-10-20 18:51 ` vehre at gmx dot de
2015-10-21 10:37 ` mikael at gcc dot gnu.org
2015-10-21 10:51 ` vehre at gcc dot gnu.org
2015-10-25 21:31 ` pault at gcc dot gnu.org
2015-10-25 21:36 ` pault 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).