From patchwork Wed May 9 22:28:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Kargl X-Patchwork-Id: 911209 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-477456-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=troutmask.apl.washington.edu Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="ayysjkR/"; 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 40h9xl3PKlz9s2k for ; Thu, 10 May 2018 08:28:56 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:reply-to:mime-version:content-type; q=dns; s=default; b=qEVqFoHK5g5noIh1K07REKKU6kjthES2Y1YZABW10fq +4xVVOP68gU0DRUgk16EEh9sQ7Jpc9CeRw6YfdGFjRaAP63vv1x6DsVgFk+R3qTw BcTRLH9eG4CSIl/YmZxByWxarouYJD1WBm++zIr//6/HvR5B08nOH6kkgKjVDzCw = 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:date :from:to:subject:message-id:reply-to:mime-version:content-type; s=default; bh=xGZbE1igvgaoS8+nINlRTLnjqG8=; b=ayysjkR/VITyHVOfU ln54LKvN4wh0MWhCJ/QW4/H9vv8cBpvh4q78rkJXU8UC2f28nnOPzVoHmuZ5ZpKV 6yTNooTBQ7kLCqMelIH1S4H8o7lRDc3TWFX6lJEcnhxyHJA7WR25uDRG+DJJqdhf koBzw4/R97YajrR9A5FL/8gQzo= Received: (qmail 52961 invoked by alias); 9 May 2018 22:28:48 -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 52667 invoked by uid 89); 9 May 2018 22:28:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-9.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_LAZY_DOMAIN_SECURITY autolearn=ham version=3.3.2 spammy=steven, Hx-languages-length:1527, steinmetz, gfc_error X-Spam-User: qpsmtpd, 2 recipients X-HELO: troutmask.apl.washington.edu Received: from troutmask.apl.washington.edu (HELO troutmask.apl.washington.edu) (128.95.76.21) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 09 May 2018 22:28:46 +0000 Received: from troutmask.apl.washington.edu (localhost [127.0.0.1]) by troutmask.apl.washington.edu (8.15.2/8.15.2) with ESMTPS id w49MSihu093696 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 9 May 2018 15:28:44 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.15.2/8.15.2/Submit) id w49MSiej093687; Wed, 9 May 2018 15:28:44 -0700 (PDT) (envelope-from sgk) Date: Wed, 9 May 2018 15:28:44 -0700 From: Steve Kargl To: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [PATCH] PR fortran/85687 -- Check argument of RANK. Message-ID: <20180509222844.GA46292@troutmask.apl.washington.edu> Reply-To: sgk@troutmask.apl.washington.edu MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.2 (2017-12-15) I plan to commit the attached patch on Saturday unless someone voices an objection. 2018-05-09 Steven G. Kargl PR fortran/85687 * check.c (gfc_check_rank): Check that the argument is a data object. 2018-05-09 Steven G. Kargl PR fortran/85687 * gfortran.dg/pr85687.f90: new test. Index: gcc/fortran/check.c =================================================================== --- gcc/fortran/check.c (revision 260098) +++ gcc/fortran/check.c (working copy) @@ -3886,8 +3886,11 @@ gfc_check_rank (gfc_expr *a) ? a->value.function.esym->result->attr.pointer : a->symtree->n.sym->result->attr.pointer; - if (a->expr_type == EXPR_OP || a->expr_type == EXPR_NULL - || a->expr_type == EXPR_COMPCALL|| a->expr_type == EXPR_PPC + if (a->expr_type == EXPR_OP + || a->expr_type == EXPR_NULL + || a->expr_type == EXPR_COMPCALL + || a->expr_type == EXPR_PPC + || a->ts.type == BT_PROCEDURE || !is_variable) { gfc_error ("The argument of the RANK intrinsic at %L must be a data " Index: gcc/testsuite/gfortran.dg/pr85687.f90 =================================================================== --- gcc/testsuite/gfortran.dg/pr85687.f90 (nonexistent) +++ gcc/testsuite/gfortran.dg/pr85687.f90 (working copy) @@ -0,0 +1,8 @@ +! { dg-do compile } +! PR fortran/85687 +! Code original contributed by Gerhard Steinmetz gscfq at t-oline dot de +program p + type t + end type + print *, rank(t) ! { dg-error "must be a data object" } +end