From patchwork Mon Dec 22 15:48:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janus Weil X-Patchwork-Id: 423420 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 7B8F71400E2 for ; Tue, 23 Dec 2014 02:48:14 +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 :mime-version:date:message-id:subject:from:to:content-type; q= dns; s=default; b=LM6GVuCMN/TuAZ5JC/aYv9BX1VoBhfJ87Uk0edKGEDv9Ec X9xWaps/BCP4ApbCCb9XgSYQbvTf1YwAuucDFpzp+hItSlXZdCeNQ2W2PKPk3M8H YuxzCRLMk3t4NUlt6kOb4xcOpKknnTShaIP4/u37D8qE9ns5Nhpfl4ha5gZOA= 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 :mime-version:date:message-id:subject:from:to:content-type; s= default; bh=qDyeVFlivsex/8eOclhRQPCwRDs=; b=QwB6ECTrRMR4mRTPI0GF 98pAebALegJh/j1e7Gd8iEe5MIr1lvY5TkqZXtFSKfrmpmMXTJWlHC8SxaVL/Mc/ xYcAVtY4WseEzG8c8kvhRsrmsq8TfQfDAcFzSkMYe07HGVLLSAC7j1ACQp2WTG/8 a93WQ6SsOD5nmFSev7r78dY= Received: (qmail 30106 invoked by alias); 22 Dec 2014 15:48:07 -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 30088 invoked by uid 89); 22 Dec 2014 15:48:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-qc0-f177.google.com Received: from mail-qc0-f177.google.com (HELO mail-qc0-f177.google.com) (209.85.216.177) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 22 Dec 2014 15:48:05 +0000 Received: by mail-qc0-f177.google.com with SMTP id x3so3493211qcv.36; Mon, 22 Dec 2014 07:48:03 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.140.39.201 with SMTP id v67mr35034154qgv.45.1419263282893; Mon, 22 Dec 2014 07:48:02 -0800 (PST) Received: by 10.96.211.7 with HTTP; Mon, 22 Dec 2014 07:48:02 -0800 (PST) Date: Mon, 22 Dec 2014 16:48:02 +0100 Message-ID: Subject: [Patch, Fortran] PR 63363: No diagnostic for passing function as actual argument to KIND From: Janus Weil To: gfortran , gcc-patches Hi all, here is a small patch which enhances the diagnostics for the intrinsic KIND function. Regtested on x86_64-unknown-linux-gnu. Ok for trunk? Cheers, Janus 2014-12-22 Janus Weil PR fortran/63363 * check.c (gfc_check_kind): Reject polymorphic and non-data arguments. 2014-12-22 Janus Weil PR fortran/63363 * gfortran.dg/kind_1.f90: New. Index: gcc/fortran/check.c =================================================================== --- gcc/fortran/check.c (Revision 219014) +++ gcc/fortran/check.c (Arbeitskopie) @@ -2531,13 +2531,20 @@ gfc_check_kill_sub (gfc_expr *pid, gfc_expr *sig, bool gfc_check_kind (gfc_expr *x) { - if (x->ts.type == BT_DERIVED) + if (x->ts.type == BT_DERIVED || x->ts.type == BT_CLASS) { - gfc_error ("%qs argument of %qs intrinsic at %L must be a " - "non-derived type", gfc_current_intrinsic_arg[0]->name, + gfc_error ("%qs argument of %qs intrinsic at %L must be of " + "intrinsic type", gfc_current_intrinsic_arg[0]->name, gfc_current_intrinsic, &x->where); return false; } + if (x->ts.type == BT_PROCEDURE) + { + gfc_error ("%qs argument of %qs intrinsic at %L must be a data entity", + gfc_current_intrinsic_arg[0]->name, gfc_current_intrinsic, + &x->where); + return false; + } return true; }