From patchwork Wed Aug 5 14:59:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Richard Thomas X-Patchwork-Id: 1341256 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=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=TTh3vn15; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BMFCh4Bckz9sPC for ; Thu, 6 Aug 2020 00:59:58 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EB1F0383E802; Wed, 5 Aug 2020 14:59:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EB1F0383E802 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1596639594; bh=EQ7VznHnByWQqXtP5bTD8WlqD1EP3JFbXuIOB9vk6zE=; h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=TTh3vn15wtKEC2DrPm784N667fu/vJNYs/l5nluMsijAeN48BVKwwTUtz4R2nwIbC Go+nq1v0pHeZaqW0Qtv5T0LCEt0Uu5do3G7VUpVB54Ffk21y4j4czy+2pIb6thKOJk +E9uMgycYhn29EbJBGz9raZEBtKJbPB1MAfx3bO0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by sourceware.org (Postfix) with ESMTPS id E757A3844041; Wed, 5 Aug 2020 14:59:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E757A3844041 Received: by mail-lf1-x12f.google.com with SMTP id s9so24460801lfs.4; Wed, 05 Aug 2020 07:59:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=cFoCQyaxk0NlGbyfbGO2shnipAgtbUIr+IXZYNmVXmM=; b=CLokhTFfLnU7TzXOqhKUBvNkuVNDvvXoAQmzrXq0HTY0MxKHMPSxjwXoFsZjfueGP1 rOzyw6x7r0yMLU9en4jRYFMvAgGq5r6FUkUxSmNGQpsTKUrc3RfJxyxtzYKKqKeXVopu o8PbolS5aVh9tNm5Sl/isg5zN7o30EdvamxqsM+XWyb3UEnKQs2Ps9xPXkbKztNkLdVm sjIZmdnRQOE60WeD1USJ0Ng7hfebKf3/3AuAQv1mjyzGt7s39CxcgKYVbc0lMX83QnU1 hFjc3V7tNyW1eiBRQx5VMQWgLyP1hpF7IyvlvLZVNG11RTW4qtzn0sG89LP4NUMX6PZx 0Lcg== X-Gm-Message-State: AOAM533IgbO9bNZMaNLP2xJ4X4DCQsB4uv8/nqWgvPuBIf/RrD5nEN3c pQKlpSnOhqCTIwqs/hpdbX+/4pWHPIXeT0lWTkKhoTHb X-Google-Smtp-Source: ABdhPJxiIMdLF4jt+LYU7jM5CPaLGYatYNVj3dmzr2RAAzGGLqLeXew5rGZbRAxotypEtTmDAYTnxDaRi5bGC12Lsx8= X-Received: by 2002:a05:6512:3a5:: with SMTP id v5mr1751912lfp.138.1596639589196; Wed, 05 Aug 2020 07:59:49 -0700 (PDT) MIME-Version: 1.0 Date: Wed, 5 Aug 2020 15:59:38 +0100 Message-ID: Subject: [Patch, fortran] PR96102 - ICE in check_host_association, at fortran/resolve.c:5994 To: "fortran@gcc.gnu.org" , gcc-patches X-Spam-Status: No, score=-8.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, HTML_MESSAGE, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Paul Richard Thomas via Gcc-patches From: Paul Richard Thomas Reply-To: Paul Richard Thomas Cc: Steve Kargl Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" The attached patch builds on a draft posted by Steve Kargl. I have left the gcc_assert in place just in case my imagination was too limited to generate an ICE. Regtests OK on FC31/x86_64 - OK for trunk? Paul diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 2751c0ccf62..4046bed1863 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -5993,6 +5993,17 @@ check_host_association (gfc_expr *e) if (ref->type == REF_ARRAY && ref->next == NULL) break; + if ((ref == NULL || ref->type != REF_ARRAY) + && old_sym->attr.flavor == FL_VARIABLE + && sym->attr.proc == PROC_INTERNAL) + { + gfc_error ("%qs at %L is being host associated into " + "a contained procedure with an internal " + "procedure of the same name", sym->name, + &sym->declared_at); + return false; + } + gcc_assert (ref->type == REF_ARRAY); /* Grab the start expressions from the array ref and