From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29634 invoked by alias); 25 Mar 2015 09:43:44 -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 29614 invoked by uid 89); 25 Mar 2015 09:43:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 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; Wed, 25 Mar 2015 09:43:41 +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 t2P9hZ5v082826 ; Wed, 25 Mar 2015 10:43:35 +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 81BF3105; Wed, 25 Mar 2015 10:43:35 +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 DN8KRYBEMyvI; Wed, 25 Mar 2015 10:43:35 +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 32413F8; Wed, 25 Mar 2015 10:43:35 +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: <20150324180620.3c72960e@vepi2> Date: Wed, 25 Mar 2015 09:43:00 -0000 Cc: Paul Richard Thomas , Mikael Morin , GCC-Fortran-ML , GCC-Patches-ML , Antony Lewis Content-Transfer-Encoding: quoted-printable Message-Id: References: <20150226181717.480e282c@vepi2> <551006FF.1080704@sfr.fr> <20150323134357.6af740d1@vepi2> <20150324180620.3c72960e@vepi2> To: Andre Vehreschild X-SW-Source: 2015-03/txt/msg01284.txt.bz2 Hi Andre, > Le 24 mars 2015 =C3=A0 18:06, Andre Vehreschild a =C3=A9cr= it : >=20 > Hi all, >=20 > I have worked on the comments Mikael gave me. I am now checking for > class_pointer in the way he pointed out. >=20 > Furthermore did I *join the two parts* of the patch into this one, because > keeping both in sync was no benefit but only tedious and did not prove to= be > reviewed faster. Are you sure that you attached the right patch? It does not apply on a clea= n tree unless I apply the patch at https://gcc.gnu.org/ml/fortran/2015-02/msg00105.html with minor surgery for gcc/fortran/expr.c. > Paul, Dominique: I have addressed the LOC issue that came up lately. Or r= ather > the patch addressed it already. I feel like this is not tested very well,= not > the loc() call nor the sizeof() call as given in the 57305 second's downl= oad. The ICE is fixed and the LOC issue seems fixed.=20 > Unfortunately, is that download not runable. I would love to see a test s= imilar > to that download, but couldn't come up with one, that satisfied me. Given= that > the patch's review will last some days, I still have enough time to come = up > with something beautiful which I will add then. I have changed the test to use iso_c_binding implicit none real, target :: e class(*), allocatable, target :: a(:) e =3D 1.0 call add_element_poly(a,e) print *, size(a) call add_element_poly(a,e) print *, size(a) select type (a) type is (real) print *, a end select 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 print *, size(a) allocate(tmp(size(a)),source=3Da) print *, size(a), size(tmp) + 1 print *, loc(a(1)),loc(tmp),sizeof(tmp) deallocate(a) ! allocate(a(size(tmp)+1),mold=3De) allocate(a(size(tmp)+1),source=3De) print *, size(a), size(tmp) 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 As pointed by Paul, I get a segfault at run time if I use the commented lin= e, i.e. =E2=80=98mold=E2=80=99 instead of =E2=80=98source=E2=80=99. > Bootstraps and regtests ok on x86_64-linux-gnu/F20. >=20 > Regards, > Andre Thanks for your work. Dominique