public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/55072] New: [4.5/4.6/4.7/4.8 Regression] Missing internal_pack leads to wrong code with derived type
@ 2012-10-25  9:22 burnus at gcc dot gnu.org
  2012-10-25  9:30 ` [Bug fortran/55072] " burnus at gcc dot gnu.org
                   ` (23 more replies)
  0 siblings, 24 replies; 25+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-10-25  9:22 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55072
           Summary: [4.5/4.6/4.7/4.8 Regression] Missing internal_pack
                    leads to wrong code with derived type
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org


The following code should print (and does so with GCC 4.1, 4.3 and 4.4):
           1           9           3          11
           1           9           3          11
However, starting from GCC 4.5, it prints:
           1           9           3          11
           1           5           9          13

The reason is that the passed pointer is not packed but directly passed (with
array descriptor, which is not used):

  bar ((struct t[0:] *) p.data);

while gfortran 4.4 correctly uses:

    D.1575 = _gfortran_internal_pack (&p);
    bar (D.1575);


implicit none
type t
integer :: i
end type t
type(t), target :: tgt(4,4)
type(t), pointer :: p(:,:)
integer :: i,j,k

k = 1
do i = 1, 4
  do j = 1, 4
    tgt(i,j)%i = k
    k = k+1
  end do
end do

p => tgt(::2,::2)
print *,p%i
call bar(p)

contains

  subroutine bar(x)
    type(t) :: x(*)
    print *,x(1:4)%i
    if (any (x(1:4)%i /= [1, 9, 3, 11])) call abort()
  end subroutine
end


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

end of thread, other threads:[~2013-01-14 21:45 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-25  9:22 [Bug fortran/55072] New: [4.5/4.6/4.7/4.8 Regression] Missing internal_pack leads to wrong code with derived type burnus at gcc dot gnu.org
2012-10-25  9:30 ` [Bug fortran/55072] " burnus at gcc dot gnu.org
2012-11-07 10:35 ` [Bug fortran/55072] [4.6/4.7/4.8 " jakub at gcc dot gnu.org
2012-12-13 21:39 ` janus at gcc dot gnu.org
2012-12-13 22:20 ` dominiq at lps dot ens.fr
2012-12-13 23:04 ` janus at gcc dot gnu.org
2012-12-14 23:18 ` janus at gcc dot gnu.org
2012-12-14 23:19 ` janus at gcc dot gnu.org
2012-12-15  0:19 ` janus at gcc dot gnu.org
2012-12-15 10:56 ` janus at gcc dot gnu.org
2012-12-15 11:00 ` janus at gcc dot gnu.org
2012-12-15 13:06 ` janus at gcc dot gnu.org
2012-12-15 13:46 ` janus at gcc dot gnu.org
2012-12-15 16:05 ` janus at gcc dot gnu.org
2012-12-15 16:17 ` mikael at gcc dot gnu.org
2012-12-15 19:46 ` janus at gcc dot gnu.org
2012-12-15 20:47 ` janus at gcc dot gnu.org
2012-12-15 21:06 ` janus at gcc dot gnu.org
2012-12-15 21:26 ` janus at gcc dot gnu.org
2012-12-15 23:41 ` janus at gcc dot gnu.org
2013-01-09 13:17 ` pault at gcc dot gnu.org
2013-01-12 18:52 ` janus at gcc dot gnu.org
2013-01-13 12:06 ` janus at gcc dot gnu.org
2013-01-14 21:25 ` janus at gcc dot gnu.org
2013-01-14 21:45 ` janus 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).