From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 122639 invoked by alias); 26 Sep 2015 13:10:53 -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 122613 invoked by uid 89); 26 Sep 2015 13:10:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: smtp24.services.sfr.fr Received: from smtp24.services.sfr.fr (HELO smtp24.services.sfr.fr) (93.17.128.83) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Sat, 26 Sep 2015 13:10:51 +0000 Received: from filter.sfr.fr (localhost [86.72.15.16]) by msfrf2418.sfr.fr (SMTP Server) with ESMTP id B1C9170000BC; Sat, 26 Sep 2015 15:10:46 +0200 (CEST) Authentication-Results: sfrmc.priv.atos.fr; dkim=none (no signature); dkim-adsp=none (no policy) header.from=mikael.morin@sfr.fr Received: from [192.168.1.85] (16.15.72.86.rev.sfr.net [86.72.15.16]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by msfrf2418.sfr.fr (SMTP Server) with ESMTP id 63F707000098; Sat, 26 Sep 2015 15:10:46 +0200 (CEST) X-SFR-UUID: 20150926131046409.63F707000098@msfrf2418.sfr.fr From: Mikael Morin Subject: [Patch, fortran] PR67721 deep copy missing when assigning derived type constructor to an array To: gcc-patches , gfortran Message-ID: <56069950.8080203@sfr.fr> Date: Sat, 26 Sep 2015 18:11:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary=------------080209000000090400070800 X-IsSubscribed: yes X-SW-Source: 2015-09/txt/msg02052.txt.bz2 This is a multi-part message in MIME format. --------------080209000000090400070800 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-length: 427 Hello, I've just submitted this PR, and the patch as well, which passes the testsuite. The problem is a missing deep copy when the rhs is a (scalar) derived type constructor (with allocatable components) and the lhs an array. The patch removes the nonconstantness condition, so that the deep_copy flag passed to gfc_trans_scalar_assign is set to true. Regression-tested on x86_64-unknown-linux-gnu. OK for trunk? Mikael --------------080209000000090400070800 Content-Type: text/plain; charset=UTF-8; name="pr67721_v1.CL" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="pr67721_v1.CL" Content-length: 387 MjAxNS0wOS0yNiAgTWlrYWVsIE1vcmluICA8bWlrYWVsQGdjYy5nbnUub3Jn PgoKCVBSIGZvcnRyYW4vNjc3MjEKCSogdHJhbnMtZXhwci5jIChnZmNfdHJh bnNfYXNzaWdubWVudF8xKTogUmVtb3ZlIHRoZSBub24tY29uc3RhbnRuZXNz Cgljb25kaXRpb24gZ3VhcmRpbmcgZGVlcCBjb3B5LgoJCjIwMTUtMDktMjYg IE1pa2FlbCBNb3JpbiAgPG1pa2FlbEBnY2MuZ251Lm9yZz4KCglQUiBmb3J0 cmFuLzY3NzIxCgkqIGdmb3J0cmFuLmRnL2FsbG9jX2NvbXBfZGVlcF9jb3B5 XzMuZjAzOiBOZXcuCg== --------------080209000000090400070800 Content-Type: text/x-patch; name="pr67721_v1.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="pr67721_v1.diff" Content-length: 558 diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index cfa1a71..e086fe3 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -9232,7 +9232,6 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag, scalar_to_array = (expr2->ts.type == BT_DERIVED && expr2->ts.u.derived->attr.alloc_comp && !expr_is_variable (expr2) - && !gfc_is_constant_expr (expr2) && expr1->rank && !expr2->rank); scalar_to_array |= (expr1->ts.type == BT_DERIVED && expr1->rank --------------080209000000090400070800 Content-Type: text/plain; charset=UTF-8; name="alloc_comp_deep_copy_3.f03" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="alloc_comp_deep_copy_3.f03" Content-length: 793 ISB7IGRnLWRvIHJ1biB9CiEKISBQUiBmb3J0cmFuLzY3NzIxCiEgQ2hlY2sg dGhhdCBzY2FsYXIgdG8gYXJyYXkgYXNzaWdubWVudHMgb2YgZGVyaXZlZCB0 eXBlIGNvbnN0cnVjdG9yCiEgZGVlcCBjb3B5IHRoZSB2YWx1ZSB3aGVuIHRo ZXJlIGFyZSBhbGxvY2F0YWJsZSBjb21wb25lbnRzLgoKcHJvZ3JhbSBwCiAg aW1wbGljaXQgbm9uZQoKICB0eXBlIDo6IHQxCiAgICBpbnRlZ2VyIDo6IGMx CiAgZW5kIHR5cGUgdDEKICB0eXBlIDo6IHQyCiAgICB0eXBlKHQxKSwgYWxs b2NhdGFibGUgOjogYzIKICBlbmQgdHlwZSB0MgoKICBibG9jawogICAgdHlw ZSh0MikgOjogdig0KQoKICAgIHYgPSB0Mih0MSgzKSkKICAgIHYoMiklYzIl YzEgPSAgNwogICAgdigzKSVjMiVjMSA9IDExCiAgICB2KDQpJWMyJWMxID0g MTMKCiAgICBpZiAodigxKSVjMiVjMSAvPSAgMykgY2FsbCBhYm9ydAogICAg aWYgKHYoMiklYzIlYzEgLz0gIDcpIGNhbGwgYWJvcnQKICAgIGlmICh2KDMp JWMyJWMxIC89IDExKSBjYWxsIGFib3J0CiAgICBpZiAodig0KSVjMiVjMSAv PSAxMykgY2FsbCBhYm9ydAogIGVuZCBibG9jawplbmQgcHJvZ3JhbSBwCg== --------------080209000000090400070800--