From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx-relay82-hz1.antispameurope.com (mx-relay82-hz1.antispameurope.com [94.100.133.251]) by sourceware.org (Postfix) with ESMTPS id 7D60F385782A for ; Thu, 18 Mar 2021 08:56:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 7D60F385782A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=net-b.de Authentication-Results: sourceware.org; spf=none smtp.mailfrom=prvs=0704ee0a59=burnus@net-b.de Received: from s041.wsp.plusnet.de ([195.90.7.81]) by mx-relay82-hz1.antispameurope.com; Thu, 18 Mar 2021 09:56:12 +0100 Received: from [172.30.65.233] (nat-ies.mentorg.com [192.94.31.2]) by s041.wsp.plusnet.de (Postfix) with ESMTPSA id 162CC2C03CC; Thu, 18 Mar 2021 09:56:08 +0100 (CET) Subject: Re: *PING*: Re: [Patch] Fortran: Fix func decl mismatch [PR93660] From: Tobias Burnus To: gcc-patches , fortran , Paul Richard Thomas References: <9d10ed6a-958c-aa97-5172-9d427a8b2b5b@codesourcery.com> <678e2be0-3c24-b998-9b9b-8b417ceee8b0@net-b.de> Message-ID: Date: Thu, 18 Mar 2021 09:56:06 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <678e2be0-3c24-b998-9b9b-8b417ceee8b0@net-b.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-cloud-security-sender: burnus@net-b.de X-cloud-security-recipient: fortran@gcc.gnu.org X-cloud-security-Virusscan: CLEAN X-cloud-security-disclaimer: This E-Mail was scanned by E-Mailservice on mx-relay82-hz1.antispameurope.com with 9C55C38E0001 X-cloud-security-connect: s041.wsp.plusnet.de[195.90.7.81], TLS=1, IP=195.90.7.81 X-cloud-security-Digest: 015c6629822846d1d2a4967dab1b3a66 X-cloud-security: scantime:1.437 X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00, BODY_8BITS, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: fortran@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Fortran mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 08:56:16 -0000 *PING* of my 11.03.21 18:15 CET patch. The issue is that the TREE_TYPE of the fndecl does not match its arglist. In some cases, the middle end looks at the function type – and then it goes wrong. The issue only occurs for -fcoarray=lib as other hidden arguments are properly handled. Solution: Add the missing args to the fndecl (in gfc_get_function_type) – and increment hidden_typelist in build_function_decl – the latter is used in a gcc_assert which was supposed to check for this mismatch ... Tobias On 14.03.21 12:04, Tobias Burnus wrote: > Early ping – and minor post script: > > +      hidden_typelist = TREE_CHAIN (hidden_typelist); > > This change is to avoid running into the ICE: > >   gcc_assert (hidden_typelist == NULL_TREE >               || TREE_VALUE (hidden_typelist) == void_type_node); > > The purpose of this assert is to check that the TREE_TYPE (fndecl) > arg list and the one created by >   create_function_arglist (gfc_symbol * sym) > are the same (at least in terms of the number of arguments). Namely: >    typelist = TYPE_ARG_TYPES (TREE_TYPE (fndecl)); > ... >   hidden_typelist = typelist; > > Tobias > > > On 11.03.21 18:15, Tobias Burnus wrote: >> This fixes an ICE with OpenMP 'omp decare simd' but is a generic bug. >> >> Namely TREE_TYPE(fndecl) has a mismatch to the arglist chain, >> missing some hidden arguments with -fcoarray=lib. >> >> OK for mainline and GCC 10? >> >> Tobias >> >> ----------------- >> Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München >> Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, >> Frank Thürauf