From patchwork Sun Oct 15 18:09:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Koenig X-Patchwork-Id: 826033 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-464231-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="Jv76VEMq"; 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 3yFTxS3bk8z9t38 for ; Mon, 16 Oct 2017 05:09:30 +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=wkLRA3Cg8ZpKNf0/UYzyoxJzNlCu+e3yoLCM4DngEn2UZe1GTA LhVujmdsbCXNDPrO24k6B7SBchWGKXJc8E/e8v8PQyh50CL5rS77MCEO2yHvAN1K tz5FXOPfs5uV6l1kjrDYk7p15eoRjttPrZrFDl5j4JiQTwY2SFMjMhx/I= 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=/OOuzB6L++7vFKqDrpuCPTEOY6E=; b=Jv76VEMqc8Bt2YigxAHz YHPb3R8e4kRWQyj2bHZgTu+1ipk8ytUMkfMEZRHyA+Ptvbdjpjb0RwGGdC9L7cSR aS/y9974YCX6A6cEDMaLKr25n+wWZaT5d7znscUfg62v1UOX9Tz6qh5ffL3IJdis dLU1cUUhleyewoggT89U4f0= Received: (qmail 49491 invoked by alias); 15 Oct 2017 18:09:22 -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 49472 invoked by uid 89); 15 Oct 2017 18:09:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=as X-Spam-User: qpsmtpd, 2 recipients X-HELO: cc-smtpout2.netcologne.de Received: from cc-smtpout2.netcologne.de (HELO cc-smtpout2.netcologne.de) (89.1.8.212) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 15 Oct 2017 18:09:19 +0000 Received: from cc-smtpin1.netcologne.de (cc-smtpin1.netcologne.de [89.1.8.201]) by cc-smtpout2.netcologne.de (Postfix) with ESMTP id C70DE124F3; Sun, 15 Oct 2017 20:09:15 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by cc-smtpin1.netcologne.de (Postfix) with ESMTP id C3D5811DB6; Sun, 15 Oct 2017 20:09:15 +0200 (CEST) Received: from [78.35.134.134] (helo=cc-smtpin1.netcologne.de) by localhost with ESMTP (eXpurgate 4.1.9) (envelope-from ) id 59e3a44b-029d-7f0000012729-7f0000019256-1 for ; Sun, 15 Oct 2017 20:09:15 +0200 Received: from [192.168.178.20] (xdsl-78-35-134-134.netcologne.de [78.35.134.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by cc-smtpin1.netcologne.de (Postfix) with ESMTPSA; Sun, 15 Oct 2017 20:09:14 +0200 (CEST) To: "fortran@gcc.gnu.org" , gcc-patches From: Thomas Koenig Subject: [patch, fortran] Fix PR 79795 Message-ID: Date: Sun, 15 Oct 2017 20:09:14 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 Hello world, the attached patch fixes a regression by turning an ICE-on-invalid into an error message (and making sure that it fits). Regression-tested on trunk. OK for all affected branches (8/7/6)? Regards Thomas 2017-10-15 Thomas Koenig PR fortran/79795 * resolve.c (resovle_symbol): Change gcc_assert to sensible error message. 2017-10-15 Thomas Koenig PR fortran/79795 * gfortran.dg/assumed_size_2.f90: New test. Index: resolve.c =================================================================== --- resolve.c (Revision 253768) +++ resolve.c (Arbeitskopie) @@ -14403,7 +14403,23 @@ resolve_symbol (gfc_symbol *sym) if (as) { - gcc_assert (as->type != AS_IMPLIED_SHAPE); + /* If AS_IMPLIED_SHAPE makes it to here, it must be a bad + specification expression. */ + if (as->type == AS_IMPLIED_SHAPE) + { + int i; + for (i=0; irank; i++) + { + if (as->lower[i] != NULL && as->upper[i] == NULL) + { + gfc_error ("Bad specification for assumed size array at %L", + &as->lower[i]->where); + return; + } + } + gcc_unreachable(); + } + if (((as->type == AS_ASSUMED_SIZE && !as->cp_was_assumed) || as->type == AS_ASSUMED_SHAPE) && !sym->attr.dummy && !sym->attr.select_type_temporary)