public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mexas at bristol dot ac.uk" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/67171] New: [6.0 regression] sourced allocation
Date: Mon, 10 Aug 2015 12:03:00 -0000	[thread overview]
Message-ID: <bug-67171-4@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2015-08-10 12:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-10 12:03 mexas at bristol dot ac.uk [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-67171-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).