From patchwork Wed Mar 20 22:20:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harald Anlauf X-Patchwork-Id: 1059585 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-498213-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="DwwFf4sI"; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.b="YOWFFF6v"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44PkrJ5m2kz9sQm for ; Thu, 21 Mar 2019 09:20:14 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=stLr/Gwedxb6jEt48IBrPJwJeH+VZoCPeK38TR8kiV3c+5 +l6E/8m2AKjnpWCZvoG57wmP5l6qJQT+wMd6IKeNmnQEdPbksntZQ1HUf0uO0PKX OMuEaP+xBGIcy1XGD6EG4QNT/hl3D3apQgTwo3poaPbRohzUqvoG5U82X0dV0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=KvIFTBquvtCigL7VYBxXbXgiHAk=; b=DwwFf4sIp7uHghOAHA2H VKHSx59hluOh5w8cR7OOy1uzqvBuYy+1VhYFdz7HNdu7NpgFiP7uPQ77PAeSL1uB 1BxIzMNCbaYz8fm9Ofax9egWnTzXN6vsCtFL+ZwnIZhcclaiatDOIsImdiVZFsu8 wTxoNN0fwUQRfU4FwoziRmk= Received: (qmail 103984 invoked by alias); 20 Mar 2019 22:20:07 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 103955 invoked by uid 89); 20 Mar 2019 22:20:06 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-9.9 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.1 spammy=determination, transfer 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 ESMTP; Wed, 20 Mar 2019 22:20:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1553120401; bh=69dSKkLYwSRahDRxZHYSxsXHB8xsYRnNm2Zhqa4UhcI=; h=X-UI-Sender-Class:Date:From:To:Subject; b=YOWFFF6v7H+IiwOiQu4sInUdn9reYIRLGU6B2wrYrBgq1w0BS13ecVPkqq8qf3um+ +Eh4fPxQ+4b9GFwqNp2x+OsYx4jLqj7S71uui/cBAkdFk1u5w4JMOUQIBlnmseP+My n6slJ+k+NgZKAhD27wQxvX10c6WDq3AczFmQk5gE= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from proton.at.home ([79.251.10.73]) by mail.gmx.com (mrgmx102 [212.227.17.168]) with ESMTPSA (Nemesis) id 0LoKHN-1gVRs00961-00gIYW; Wed, 20 Mar 2019 23:20:01 +0100 Message-ID: <5C92BC90.4070104@gmx.de> Date: Wed, 20 Mar 2019 23:20:00 +0100 From: Harald Anlauf User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: gfortran , gcc-patches Subject: [Patch, fortran] PR83515, PR85797 - ICE in gfc_element_size The PRs originated in gfc_element_size lacking a treatment of procedure pointers, which has been added. The testcase is currently a pure compile test. When a reduced run-time test for PR83515 becomes available, it will be added to the testsuite. Regtested on x86_64-pc-linux-gnu. OK for trunk? Thanks, Harald 2019-03-20 Harald Anlauf PR fortran/83515 PR fortran/85797 * trans-types.c (gfc_typenode_for_spec): Handle conversion for procedure pointers. * target-memory.c (gfc_element_size): Handle size determination for procedure pointers. 2019-03-20 Harald Anlauf PR fortran/83515 PR fortran/85797 * gfortran.dg/pr85797.f90: New test. Index: gcc/testsuite/gfortran.dg/pr85797.f90 =================================================================== --- gcc/testsuite/gfortran.dg/pr85797.f90 (nonexistent) +++ gcc/testsuite/gfortran.dg/pr85797.f90 (working copy) @@ -0,0 +1,33 @@ +! { dg-do compile } +! { dg-options "-Wall" } +! PR fortran/83515 - ICE: Invalid expression in gfc_element_size +! PR fortran/85797 - ICE in gfc_element_size, at fortran/target-memory.c:126 + +subroutine a + c = transfer (a, b) ! { dg-warning "Non-RECURSIVE procedure" } +end + +recursive subroutine d + c = transfer (d, b) +end + +recursive subroutine e + k = transfer (transfer (e, e), 1) +end + +subroutine f + use, intrinsic :: iso_c_binding + integer(c_intptr_t) :: b, c + c = transfer (transfer (b, a), b) +end + +module m +contains + function f () result (z) ! { dg-warning "Return value" } + class(*), pointer :: z + end function f + recursive subroutine s (q) + procedure(f) :: q + call s (q) + end subroutine s +end Index: gcc/fortran/target-memory.c =================================================================== --- gcc/fortran/target-memory.c (revision 269826) +++ gcc/fortran/target-memory.c (working copy) @@ -120,6 +120,7 @@ case BT_CLASS: case BT_VOID: case BT_ASSUMED: + case BT_PROCEDURE: { /* Determine type size without clobbering the typespec for ISO C binding types. */ Index: gcc/fortran/trans-types.c =================================================================== --- gcc/fortran/trans-types.c (revision 269826) +++ gcc/fortran/trans-types.c (working copy) @@ -1194,6 +1194,9 @@ basetype = pfunc_type_node; } break; + case BT_PROCEDURE: + basetype = pfunc_type_node; + break; default: gcc_unreachable (); }