From patchwork Fri Oct 18 12:46:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 1179349 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-511285-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="gaAU+ewR"; 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 46vm5C1wwzz9sPZ for ; Fri, 18 Oct 2019 23:47:11 +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=T+sdnH+1hBm6TCy7tTOEcPuED/K3Vvu0JYr0uTGg9eHT+7tMOX sl+r5dDY4Sh40E1qtYFgGxwwLZ9KFwCjge/MByxh79yNQ0JdewmKZkmzQzIJZSWU yqbLcFNf3JsME7ASTSwIoleMiaJrpYhCFqQV7oYyfQvTtC2Izt2WdmsFM= 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=FksTPAmQWb94uTVOtM9h364xVjw=; b=gaAU+ewRoYRgl0ZV7goe vmSjFIHKFtzoMmds0zGKgfy58Kzwl6DQKYXC05T1/bN31+5t7+0XMMF5SMChJtg2 r+eHQkAZJzTxf87g54F0T/v3A4jMmyZH81i9HNDlUe4UyNCclXyJBBw3K/odY+rL JR8tw2erPYIyLUADV6okvvA= Received: (qmail 79273 invoked by alias); 18 Oct 2019 12:47:03 -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 79029 invoked by uid 89); 18 Oct 2019 12:47:02 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: esa1.mentor.iphmx.com Received: from esa1.mentor.iphmx.com (HELO esa1.mentor.iphmx.com) (68.232.129.153) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 18 Oct 2019 12:47:01 +0000 IronPort-SDR: i6xizrnlQADYx+AMD2CU0QKUxEI762shSwEJtmzwVivLH6qhHjWv27hsKKTkSSOS5VWiGyNqRu cBeH1x0nZTtwEIuk/ID2BPsW1Ka9G7HI/W8t6XKETYKL8kAzF/YAO+V9YXOcYGtpjuGJ/y7H/s XpecW69A5MCzOauyW8AaYhjPqFokttoVj7aeJcg2StoqmbmmirLlehxUtjpxHyCrfk7IAmqXKn 64v81MEkaSXm0W/6pnml/ObaV4lPucLHWZmJ4fBfowRlQtLrBwiiXewfNfqQZoEv1SiKniyrcq O+0= Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa1.mentor.iphmx.com with ESMTP; 18 Oct 2019 04:46:59 -0800 IronPort-SDR: 0yCvkoUOjO/qxT5gQCiHipiVea6wY8oSglw5lbKe5XRgavaDFrxMXE89n2tpT+gS0cNej/evl3 crYND88Y6nQvZCUGf67qhjtav57bqtAUR32sqtYsQy7qH2WbEwtaubMxaNFfEA0EY48EaUG/8D Yd+WHlx7UYPQ5jJO6m4tC49RLiFaer65gTzwtuoAQqJf3IAao6XU+TpimewljMuSJmrKqEDvXo HHi14nuqOTumO6lr27GomgLyAn2py19MGDqZu7RD6+Kl/nMGbNl7RNJWi8kb+WcNiyLZTm/qMb 21k= To: gcc-patches , fortran From: Tobias Burnus Subject: [Patch, committed, Fortran] PR91586 Fix ICE on invalid code with CLASS Message-ID: Date: Fri, 18 Oct 2019 14:46:45 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0 MIME-Version: 1.0 X-IsSubscribed: yes Re-instate error message which got by dereferrencing a NULL pointer. Commited as r277153 to the trunk. Committed as r277154 to the GCC 9 branch (as it was a 9/10 regression). Thanks, Tobias commit f9aef7e7d320df8560e602d863e97ea324e68644 Author: burnus Date: Fri Oct 18 12:04:31 2019 +0000 Fortran] PR91586 Fix ICE on invalid code with CLASS gcc/fortran/ PR fortran/91586 * class.c (gfc_find_derived_vtab): Return NULL instead of deref'ing NULL pointer. gcc/testsuite/ PR fortran/91586 * gfortran.dg/class_71.f90: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@277153 138bc75d-0d04-0410-961f-82ee72b054a4 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 1dbc890f5da..8a1beeafa01 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2019-10-18 Tobias Burnus + + PR fortran/91586 + * class.c (gfc_find_derived_vtab): Return NULL + instead of deref'ing NULL pointer. + 2019-10-15 James Norris Tobias Burnus diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c index 8a1f43f116c..9117121e5fe 100644 --- a/gcc/fortran/class.c +++ b/gcc/fortran/class.c @@ -2241,6 +2241,9 @@ gfc_find_derived_vtab (gfc_symbol *derived) if (!derived->attr.unlimited_polymorphic && derived->attr.is_class) derived = gfc_get_derived_super_type (derived); + if (!derived) + return NULL; + /* Find the gsymbol for the module of use associated derived types. */ if ((derived->attr.use_assoc || derived->attr.used_in_submodule) && !derived->attr.vtype && !derived->attr.is_class) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b783c8dede3..4e817eb1371 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-10-18 Tobias Burnus + + PR fortran/91586 + * gfortran.dg/class_71.f90: New. + 2019-10-18 Georg-Johann Lay Fix some fallout for small targets. diff --git a/gcc/testsuite/gfortran.dg/class_71.f90 b/gcc/testsuite/gfortran.dg/class_71.f90 new file mode 100644 index 00000000000..bc0ffcd2305 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/class_71.f90 @@ -0,0 +1,13 @@ +! { dg-do compile } +! +! PR fortran/91586 +! +! Contributed by G. Steinmetz +! +program p + type t + class(*), allocatable :: a + end type + class(t) :: x, y ! { dg-error "must be dummy, allocatable or pointer" } + y = x ! { dg-error "Nonallocatable variable must not be polymorphic in intrinsic assignment" } +end