From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 87357 invoked by alias); 24 Oct 2015 13:08:34 -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 87339 invoked by uid 89); 24 Oct 2015 13:08:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-ob0-f169.google.com Received: from mail-ob0-f169.google.com (HELO mail-ob0-f169.google.com) (209.85.214.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Sat, 24 Oct 2015 13:08:32 +0000 Received: by obctp1 with SMTP id tp1so85583878obc.2; Sat, 24 Oct 2015 06:08:30 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.60.60.65 with SMTP id f1mr18273044oer.43.1445692110176; Sat, 24 Oct 2015 06:08:30 -0700 (PDT) Received: by 10.202.168.133 with HTTP; Sat, 24 Oct 2015 06:08:30 -0700 (PDT) Date: Sat, 24 Oct 2015 13:46:00 -0000 Message-ID: Subject: [Patch, fortran] PR67171 - [6 regression] sourced allocation From: Paul Richard Thomas To: "fortran@gcc.gnu.org" , gcc-patches Content-Type: text/plain; charset=UTF-8 X-SW-Source: 2015-10/txt/msg02580.txt.bz2 Dear All, This patch does four things: (i) On deallocating class components, the vptr is set to point to the vtable of the declared type; (ii) When digging out the last class reference, a NULL is returned if the allocatable component is to the right of a part reference with non-zero rank, so that the resulting ICE is removed. The previous modification takes care of these cases for gfc_reset_vptr and gfc_reset_len; (iii) gfc_reset_vptr has been simplified by the use of gfc_get_vptr_from_expr; and (iv) All variable expressions for the source are passed to gfc_trans-assignment, so that array sections work correctly. I see that Andre has already reserved the testcase allocate_with_source_10, for the pending patch that I undertook to review, so I will change this to #12 on submission OK for trunk? Cheers Paul 2015-01-24 Paul Thomas PR fortran/67171 * trans-array.c (structure_alloc_comps): On deallocation of class components, reset the vptr to the declared type vtable and reset the _len field of unlimited polymorphic components. *trans-expr.c (gfc_find_and_cut_at_last_class_ref): Bail out on allocatable component references to the right of part reference with non-zero rank and return NULL. (gfc_reset_vptr): Simplify this function by using the function gfc_get_vptr_from_expr. Return if the vptr is NULL_TREE. (gfc_reset_len): If gfc_find_and_cut_at_last_class_ref returns NULL return. * trans-stmt.c (gfc_trans_allocate): Rely on the use of gfc_trans_assignment if expr3 is a variable expression since this deals correctly with array sections. 2015-01-24 Paul Thomas PR fortran/67171 * gfortran.dg/allocate_with_source_10.f03: New test