From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 84548 invoked by alias); 26 Mar 2015 09:27:10 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 84487 invoked by uid 89); 26 Mar 2015 09:27:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: nef2.ens.fr Received: from nef2.ens.fr (HELO nef2.ens.fr) (129.199.96.40) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 26 Mar 2015 09:27:07 +0000 Received: from mailhost.lps.ens.fr (tournesol.lps.ens.fr [129.199.120.1]) by nef2.ens.fr (8.13.6/1.01.28121999) with ESMTP id t2Q9QxoY001263 ; Thu, 26 Mar 2015 10:27:00 +0100 (CET) X-Envelope-To: gcc-patches@gcc.gnu.org Received: from localhost (localhost [127.0.0.1]) by mailhost.lps.ens.fr (Postfix) with ESMTP id DF838105; Thu, 26 Mar 2015 10:26:59 +0100 (CET) Received: from mailhost.lps.ens.fr ([127.0.0.1]) by localhost (tournesol.lps.ens.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7wcyLQsUNVC5; Thu, 26 Mar 2015 10:26:59 +0100 (CET) Received: from [192.168.1.11] (log78-1-82-242-47-10.fbx.proxad.net [82.242.47.10]) by mailhost.lps.ens.fr (Postfix) with ESMTPSA id 8DE11F8; Thu, 26 Mar 2015 10:26:59 +0100 (CET) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) Subject: Re: [Patch, Fortran, pr60322] was: [Patch 1/2, Fortran, pr60322] [OOP] Incorrect bounds on polymorphic dummy array From: =?utf-8?Q?Dominique_d=27Humi=C3=A8res?= In-Reply-To: <20150325175643.3b95cb42@vepi2> Date: Thu, 26 Mar 2015 09:27:00 -0000 Cc: Paul Richard Thomas , Mikael Morin , GCC-Fortran-ML , GCC-Patches-ML , Antony Lewis Content-Transfer-Encoding: quoted-printable Message-Id: <2E95FE29-6605-4054-91DB-C00249F6850F@lps.ens.fr> References: <20150226181717.480e282c@vepi2> <551006FF.1080704@sfr.fr> <20150323134357.6af740d1@vepi2> <20150324180620.3c72960e@vepi2> <20150325175643.3b95cb42@vepi2> To: Andre Vehreschild X-SW-Source: 2015-03/txt/msg01352.txt.bz2 Dear Andre, Everything works as expected with your new patch.=20 I have changed the test for pr57305 to use iso_c_binding implicit none integer :: i real, target :: e class(*), allocatable, target :: a(:) do i =3D 1, 3 e =3D i=20 call add_element_poly(a,e) select type (a) type is (real) print *, a end select end do contains subroutine add_element_poly(a,e) use iso_c_binding class(*),allocatable,intent(inout),target :: a(:) class(*),intent(in),target :: e class(*),allocatable,target :: tmp(:) type(c_ptr) :: dummy =20=20=20=20=20=20 interface function memcpy(dest,src,n) bind(C,name=3D"memcpy") result(res) import type(c_ptr) :: res integer(c_intptr_t),value :: dest integer(c_intptr_t),value :: src integer(c_size_t),value :: n end function end interface if (.not.allocated(a)) then allocate(a(1), source=3De) else allocate(tmp(size(a)),source=3Da) deallocate(a) allocate(a(size(tmp)+1),mold=3De) dummy =3D memcpy(loc(a(1)),loc(tmp),sizeof(tmp)) dummy =3D memcpy(loc(a(size(tmp)+1)),loc(e),sizeof(e)) end if end subroutine end and get the expected outputs at run time (it works also if I replace MOLD w= ith SOURCE and remove the second =E2=80=98dummy =3D =E2=80=A6=E2=80=99 line= ). Thanks for your patience, Dominique > Le 25 mars 2015 =C3=A0 17:56, Andre Vehreschild a =C3=A9cr= it : >=20 > Hi Dominique, hi all, >=20 > you are absolutely right, Dominique: I missed the part of pr60322_base_*.= =20 >=20 > But this time it is there and furthermore does solve the allocate( mold= =3De) and > the loc(e) issue.=20 >=20 > Paul: I have simplified your patch by only checking whether the > arg_expr.ts.type =3D=3D BT_CLASS. All tests showed, that this enough to p= roduce the > correct code. >=20 > Bootstraps and regtests ok on x86_64-linux-gnu/F20.=20 >=20 > Comments, please! >=20 > Regards, > Andre >=20 > On Wed, 25 Mar 2015 10:43:34 +0100 > Dominique d'Humi=C3=A8res wrote: