From patchwork Tue Dec 10 18:37:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Koenig X-Patchwork-Id: 1207208 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-515635-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=netcologne.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="xJ+wO4xQ"; dkim=pass (2048-bit key; unprotected) header.d=netcologne.de header.i=@netcologne.de header.b="jCnoFhgS"; 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 47XTMB3rt4z9sPJ for ; Wed, 11 Dec 2019 05:37:40 +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=FlBmAeOVWnPTD7GE1Ev7dH3wCvSIZml+k5cRBzsvoLuocLAYaX DN+2vCZSTDVWsDJxE823bSWuvm/Y4SXnjkmMKtN0CaicBV706gP2yl46kX6C0P91 zSkgU7j9nJZ4bhSS2BYkhOUhHSmDKdQ6b9st+f9vy3d2oLs7q4hfaFDgU= 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=i+pFhYLu5qNdn+WqCzW+v70lTgw=; b=xJ+wO4xQ8oGZJCX/KuvP hUEa0buFVm/D5AHJos2XQ+gYG/II3t/e7h01f5XycMWh6sNKzMrtixKJ06coWdQz vIL1lNepmAGz5D7vmY2RwYN7M2D7CuZbV9ruEytg5EI6iJfBgv0pUDvUI0rQfxdN FCVA4fFYVBiRv6CjF/KXQpg= Received: (qmail 49625 invoked by alias); 10 Dec 2019 18:37:29 -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 49605 invoked by uid 89); 10 Dec 2019 18:37:29 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-12.6 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: cc-smtpout1.netcologne.de Received: from cc-smtpout1.netcologne.de (HELO cc-smtpout1.netcologne.de) (89.1.8.211) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 10 Dec 2019 18:37:27 +0000 Received: from cc-smtpin3.netcologne.de (cc-smtpin3.netcologne.de [89.1.8.203]) by cc-smtpout1.netcologne.de (Postfix) with ESMTP id B02C512B19; Tue, 10 Dec 2019 19:37:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=netcologne.de; s=nc1116a; t=1576003044; bh=JPmiAHiFAEaiZJIp3ihh9ydS5bq/LsFcha39Gb5SiTg=; h=To:From:Subject:Message-ID:Date:From; b=jCnoFhgSV5RegRmrciTHCClLF6VNDx/1W308K8A5QJVQZngdNxu8mz5g9lusadspV EXlSaBPp1iJg0ZDkxUq4gT5AZiBGD89sgDBFdsxYyYn4Kfz3GTKWi6cuzrtSDt9VAK SngfQfMBUFwErSXB9fW/NJlMiSiQGsM+PsnL1avvYOAmqfadjQ5HretDR9FSVT5ypk c2wVjtVvsnql1NlILPtsuLChl3zdA/zIgT3ToU4KHd/YDUw4YE1PPejbuFg/dfCmFR HF0Cl8XsNs6XKBBglvHz5/jeQeWMqod+4u8sYoqNPsq5FBSaFT2nOcwMgzqRuhTUjY 7MBTC6eh7S+8w== Received: from localhost (localhost [127.0.0.1]) by cc-smtpin3.netcologne.de (Postfix) with ESMTP id AC3E511EE5; Tue, 10 Dec 2019 19:37:24 +0100 (CET) Received: from [2001:4dd7:c4e0:0:7285:c2ff:fe6c:992d] (helo=cc-smtpin3.netcologne.de) by localhost with ESMTP (eXpurgate 4.11.6) (envelope-from ) id 5defe5e4-7104-7f0000012729-7f00000196f4-1 for ; Tue, 10 Dec 2019 19:37:24 +0100 Received: from [IPv6:2001:4dd7:c4e0:0:7285:c2ff:fe6c:992d] (2001-4dd7-c4e0-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de [IPv6:2001:4dd7:c4e0:0:7285:c2ff:fe6c:992d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by cc-smtpin3.netcologne.de (Postfix) with ESMTPSA; Tue, 10 Dec 2019 19:37:23 +0100 (CET) To: "fortran@gcc.gnu.org" , gcc-patches From: Thomas Koenig Subject: [patch, fortran, committed] Fix PR 92863, 'ICE in gfc_typename Message-ID: <45f4fd37-d504-32a8-82b7-beaf1d812fde@netcologne.de> Date: Tue, 10 Dec 2019 19:37:22 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 Hello world, I have just committed the attached patch as obvious and simple as r279180. The ICE for the test case occurred because a previous error had left the derived field of the typespec NULL. Just returning "invalid type" or "invalid class" in such a case is enough to cure the ICE. Regards Thomas 2019-12-10 Thomas Koenig PR fortran/92863 * misc.c (gfc_typename): If derived component is NULL for derived or class, return "invalid type" or "invalid class", respectively. 2019-12-10 Thomas Koenig PR fortran/92863 * gfortran.dg/interface_45.f90: New test. Index: misc.c =================================================================== --- misc.c (Revision 279064) +++ misc.c (Arbeitskopie) @@ -164,9 +164,19 @@ gfc_typename (gfc_typespec *ts) sprintf (buffer, "UNION(%s)", ts->u.derived->name); break; case BT_DERIVED: + if (ts->u.derived == NULL) + { + sprintf (buffer, "invalid type"); + break; + } sprintf (buffer, "TYPE(%s)", ts->u.derived->name); break; case BT_CLASS: + if (ts->u.derived == NULL) + { + sprintf (buffer, "invalid class"); + break; + } ts1 = ts->u.derived->components ? &ts->u.derived->components->ts : NULL; if (ts1 && ts1->u.derived && ts1->u.derived->attr.unlimited_polymorphic) sprintf (buffer, "CLASS(*)");