From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 97381 invoked by alias); 26 Oct 2015 13:04:32 -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 97362 invoked by uid 89); 26 Oct 2015 13:04:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KAM_ASCII_DIVIDERS,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mout.gmx.net Received: from mout.gmx.net (HELO mout.gmx.net) (212.227.17.21) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 26 Oct 2015 13:04:22 +0000 Received: from vepi2 ([92.213.0.123]) by mail.gmx.com (mrgmx101) with ESMTPSA (Nemesis) id 0M1SLt-1afmpI31mz-00tVGd; Mon, 26 Oct 2015 14:04:13 +0100 Date: Mon, 26 Oct 2015 13:07:00 -0000 From: Andre Vehreschild To: Paul Richard Thomas Cc: Dominique =?UTF-8?B?ZCdIdW1pw6hyZXM=?= , gcc-patches , Mikael Morin , GNU GFortran Subject: Re: [Patch, Fortran, 66927, v2.1] [6 Regression] ICE in gfc_conf_procedure_call Message-ID: <20151026140411.52cefdbf@vepi2> In-Reply-To: References: <20151025133102.2aa5ebd6@vepi2> <20151026110314.29862118@vepi2> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/DS9q81kyzZQOhBpbp5hiXeu" X-UI-Out-Filterresults: notjunk:1;V01:K0:wRYXUoahGaQ=:GCptSWOQ+14a11gJM6kjLf eLdJnLULpuX9hi3N2bDYALN9OzG4l/OUD3d7mYlvAtkE7H3aVC9hxSc49IETluCR4m3AMKofN 4ocrWiQQzgIfzy5hOQJdNazsEGIAD4xV9ph2GH9134bkVqi33BS94EudK1t+GgTDPPbSj73Rr S22wFyExrt+yyxlZExlWvFQIqQNfseefXD+6Kcz9y5W7bDzv0phQz0dF4yBAjxNAlezpUear2 0MaFXfgrBBCx3HRjoGURbPghiJNblTdEApET0VCMtSMkdyC4+0XRYYNVYxk2N1OSmaH9LQjIo kQ77AuSEAz439r+yzCCtRNXMDCkJxDLahGzuUUa4q4TDcieKF3flDjeB4MzhLATyi2uaV7NEi 0wgPpbXSOVznJZRdRT3rl85ILIooLjWyHMAp+LjYl34xX4RvgNGD586xYpWQpjNPfnVfbaZxi 4y7g+awU6ZfCmK/5wt8/GHHjtvEZm8FvXjT3DWBgyHZ6/LAwO6H6JU1145VYDyFIYVGNUXU0w LnS77ZdLw0d0cSV7KAOma1gBvZCjO3FieC7KUamE8cFXPWTluqpOeQzDXmCDvn3/FgIN9x3ni +nn61HoVH/rRtUgggBVOK/6pmuA4xpFZwQPkPQC904FRJE17ZCEoHZR9nR8W4NGLk5CT/KQsL cQhuhElpuxOUHg7IeZJn1zx3ZfVzLmzrFo2GM32HoBc8aL2kbvYCX7SlyA4UlploAPpcRQ6HH vv1x9/37ZvcdDaQT+JrkcZqFjTpbuQ2jd7B7qBJv4TmPf0T5lqIBm1mhXeI= X-SW-Source: 2015-10/txt/msg02735.txt.bz2 --MP_/DS9q81kyzZQOhBpbp5hiXeu Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Content-length: 3191 Hi Paul, thanks for the quick review. Submitted as r229353. Many thanks and regards, Andre On Mon, 26 Oct 2015 13:04:27 +0100 Paul Richard Thomas wrote: > Hi Andre, >=20 > Yes, that's good to fix the problem. OK to commit >=20 > Thanks for the rapid fix. >=20 > Paul >=20 > On 26 October 2015 at 11:03, Andre Vehreschild wrote: > > Hi all, > > > > unfortunately did my last patch create a segfault on some 32-bit > > system. This happens because in the scalarizer the lower bound of the > > deferred length array of the source=3D expression was taken to be > > constant zero instead of taking that information from the array > > descriptor. This patch fixes the segfault by taking the lower -- and to > > keep it in sync also the upper -- bound from the array descriptor when > > doing the array assign in the allocate (). > > > > Bootstrapped and regtested on x86_64-linux-gnu/f21. > > > > Ok for trunk? > > > > Sorry for the regression. > > > > Regards, > > Andre > > > > On Sun, 25 Oct 2015 13:31:02 +0100 > > Andre Vehreschild wrote: > > > >> Hi Paul, hi all, > >> > >> thanks for the review. Submitted as r229294. > >> > >> Regards, > >> Andre > >> > >> On Sun, 25 Oct 2015 08:43:24 +0100 > >> Paul Richard Thomas wrote: > >> > >> > Dear Andre, > >> > > >> > As far as I can see, the problems with PR57117 are specific to RESHA= PE > >> > and need not affect committing your patch. To my surprise, the > >> > combination of your patch and mine for PR67171 fixes PR67044 in that > >> > the ICE no longer occurs. I have to get my head around how to write a > >> > testcase for it that tests the functionality though! > >> > > >> > You can commit this patch to trunk. As I said elsewhere, I will rena= me > >> > the testcase for PR67171. > >> > > >> > Many thanks for the patch. > >> > > >> > Paul > >> > > >> > On 23 October 2015 at 09:44, Paul Richard Thomas > >> > wrote: > >> > > Dear Andre, > >> > > > >> > > I will wait until you fix the problems that Dominique has pointed = out. > >> > > However, if by Sunday afternoon (rain forecast!) you haven't found= the > >> > > time, I will see if I can locate the source of these new problems. > >> > > > >> > > With best regards > >> > > > >> > > Paul > >> > > > >> > > On 7 October 2015 at 19:51, Dominique d'Humi=C3=A8res wrote: > >> > >> This patch also fixes pr57117 comment 2, the original test and th= e test in comment 3 now give an ICE > >> > >> > >> > >> pr57117.f90:82:0: > >> > >> > >> > >> allocate(z(9), source=3Dreshape(x, (/ 9 /))) > >> > >> 1 > >> > >> internal compiler error: Segmentation fault: 11 > >> > >> > >> > >> and pr67044. > >> > >> > >> > >> Thanks, > >> > >> > >> > >> Dominique > >> > >> > >> > > > >> > > > >> > > > >> > > -- > >> > > Outside of a dog, a book is a man's best friend. Inside of a dog i= t's > >> > > too dark to read. > >> > > > >> > > Groucho Marx > >> > > >> > > >> > > >> > >> > > > > > > -- > > Andre Vehreschild * Email: vehre ad gmx dot de >=20 >=20 >=20 --=20 Andre Vehreschild * Email: vehre ad gmx dot de=20 --MP_/DS9q81kyzZQOhBpbp5hiXeu Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=submit.diff Content-length: 2883 Index: gcc/fortran/ChangeLog =================================================================== --- gcc/fortran/ChangeLog (Revision 229352) +++ gcc/fortran/ChangeLog (Arbeitskopie) @@ -1,3 +1,13 @@ +2015-10-26 Andre Vehreschild + + PR fortran/66927 + * trans-array.c (evaluate_bound): For deferred length arrays get the + bounds directly from the descriptor, i.e., prevent using constant + zero lower bound from the gfc_conv_array_lbound () routine. + (gfc_conv_section_startstride): Hand deferred array status to + evaluate_bound (). + (gfc_conv_expr_descriptor): Same. + 2015-01-25 Paul Thomas PR fortran/67171 Index: gcc/fortran/trans-array.c =================================================================== --- gcc/fortran/trans-array.c (Revision 229352) +++ gcc/fortran/trans-array.c (Arbeitskopie) @@ -3809,7 +3809,7 @@ static void evaluate_bound (stmtblock_t *block, tree *bounds, gfc_expr ** values, - tree desc, int dim, bool lbound) + tree desc, int dim, bool lbound, bool deferred) { gfc_se se; gfc_expr * input_val = values[dim]; @@ -3824,6 +3824,17 @@ gfc_add_block_to_block (block, &se.pre); *output = se.expr; } + else if (deferred) + { + /* The gfc_conv_array_lbound () routine returns a constant zero for + deferred length arrays, which in the scalarizer wrecks havoc, when + copying to a (newly allocated) one-based array. + Keep returning the actual result in sync for both bounds. */ + *output = lbound ? gfc_conv_descriptor_lbound_get (desc, + gfc_rank_cst[dim]): + gfc_conv_descriptor_ubound_get (desc, + gfc_rank_cst[dim]); + } else { /* No specific bound specified so use the bound of the array. */ @@ -3864,15 +3875,19 @@ desc = info->descriptor; stride = ar->stride[dim]; + /* Calculate the start of the range. For vector subscripts this will be the range of the vector. */ - evaluate_bound (block, info->start, ar->start, desc, dim, true); + evaluate_bound (block, info->start, ar->start, desc, dim, true, + ar->as->type == AS_DEFERRED); /* Similarly calculate the end. Although this is not used in the scalarizer, it is needed when checking bounds and where the end is an expression with side-effects. */ - evaluate_bound (block, info->end, ar->end, desc, dim, false); + evaluate_bound (block, info->end, ar->end, desc, dim, false, + ar->as->type == AS_DEFERRED); + /* Calculate the stride. */ if (stride == NULL) info->stride[dim] = gfc_index_one_node; @@ -6965,7 +6980,8 @@ gcc_assert (n == codim - 1); evaluate_bound (&loop.pre, info->start, ar->start, - info->descriptor, n + ndim, true); + info->descriptor, n + ndim, true, + ar->as->type == AS_DEFERRED); loop.from[n + loop.dimen] = info->start[n + ndim]; } else --MP_/DS9q81kyzZQOhBpbp5hiXeu--