From patchwork Mon Jan 28 19:49:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Thomas_K=C3=B6nig?= X-Patchwork-Id: 1032212 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-494854-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=tkoenig.net Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="iXphRQv2"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=tkoenig.net header.i=@tkoenig.net header.b="sIya7ZX4"; 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 43pKwc42shz9sDK for ; Tue, 29 Jan 2019 06:50:06 +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:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=d3qmH+H08lCnyoq3FD03a+9z0k6byHKqMk+ePylfM+ieG5M2hn cJSggRsEP856VsU9yle3463IJNwYch+RL3TO1WPSBJeIBki8/umC+/0wFmIbSkRV 62iM3ep61om+SWDu6e3CZet6QC3CsGGZmld6X+5kTxr2CUGoiNteePYvk= 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:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=BaghkQanHsM1tLmdkqqbjEmA3hM=; b=iXphRQv2usCb8JW7piFb 3ELIjD98xZ2euoG+WUCHJJmwpkKGwpjt952L9UV5paQ6K9PmOsv+IRhTJn1eLM9X AQOfghHo+txiBm51T7BexLxH9257iaLpUVP2B/hP6SOECBhx1TcXCnhjv0zkn3hF XKKGZZk9rHo2jkUCQ8kQaIM= Received: (qmail 53169 invoked by alias); 28 Jan 2019 19:49:59 -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 53153 invoked by uid 89); 28 Jan 2019 19:49:58 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.4 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=long-time, longtime, H*r:521, our X-HELO: mo4-p00-ob.smtp.rzone.de Received: from mo4-p00-ob.smtp.rzone.de (HELO mo4-p00-ob.smtp.rzone.de) (81.169.146.160) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 28 Jan 2019 19:49:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1548704993; s=strato-dkim-0002; d=tkoenig.net; h=Date:Message-ID:Subject:From:To:X-RZG-CLASS-ID:X-RZG-AUTH:From: Subject:Sender; bh=7IQ4i+GIdZDiJrnjuVM3vcfn1VUiFf3pqM3p6lUy4PU=; b=sIya7ZX4t1L49rMWoj1KAFbLHgB1nE0n2tzDlY32/ystjysUkNNLzJvBGOnQ9MzrtR S5dj1i7RCfcbj/yrPoulTnCmQcAvdXAB77se4wRELrEXSoX097lHFuuJ3W625AenelJU DjrV/heozbwCNfs3A9RuIx94iqHbwqQXhgjCqWzCl7Hyz3kJevuLSmopGxZ/y6hNzZXs UjfbrTMCylRywsoqMVpGENwMHu8gItk5zS+8IJIrBpUAivgf9BvSYEykk+RPDQz3hRX3 L26NsNNN+6WODMvxw2ULZa+Kq1b9oQjt8lPHzCy8naAVkrZktsG72mzBrLu3DlvJOSfP 69QA== Received: from [192.168.178.68] by smtp.strato.de (RZmta 44.9 DYNA|AUTH) with ESMTPSA id K00908v0SJnqYEM (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Mon, 28 Jan 2019 20:49:52 +0100 (CET) To: "fortran@gcc.gnu.org" , gcc-patches From: =?utf-8?q?Thomas_K=C3=B6nig?= Subject: [patch, fortran] Fix PR 57048 Message-ID: <6f50fa14-64b4-3e6d-d051-e06bcdfd7f82@tkoenig.net> Date: Mon, 28 Jan 2019 20:49:52 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 Hello world, let the regression hunt continue! the attached patch fixes a long-time regression where a c_funptr from a module could not be found. The solution is a bit of a hack, but so is our whole implementation of the C interop stuff. Regression-tested. OK for trunk? Regards Thomas 2019-01-28 Thomas Koenig PR fortran/57048 * interface.c (gfc_compare_types): If a derived type and an integer both have a derived type, and they are identical, this is a C binding type and compares equal. 2019-01-28 Thomas Koenig PR fortran/57048 * gfortran.dg/c_funptr_1.f90: New file. * gfortran.dg/c_funptr_1_mod.f90: New file. Index: interface.c =================================================================== --- interface.c (Revision 268104) +++ interface.c (Arbeitskopie) @@ -692,6 +692,15 @@ gfc_compare_types (gfc_typespec *ts1, gfc_typespec if (ts1->type == BT_VOID || ts2->type == BT_VOID) return true; + /* Special case for our C interop types. There should be a better + way of doing this... */ + + if (((ts1->type == BT_INTEGER && ts2->type == BT_DERIVED) + || (ts1->type == BT_DERIVED && ts2->type == BT_INTEGER)) + && ts1->u.derived && ts2->u.derived + && ts1->u.derived == ts2->u.derived) + return true; + /* The _data component is not always present, therefore check for its presence before assuming, that its derived->attr is available. When the _data component is not present, then nevertheless the