From patchwork Wed Jun 9 20:59:24 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Franke X-Patchwork-Id: 55127 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]) by ozlabs.org (Postfix) with SMTP id A1568B7D66 for ; Thu, 10 Jun 2010 07:00:24 +1000 (EST) Received: (qmail 2038 invoked by alias); 9 Jun 2010 21:00:19 -0000 Received: (qmail 2014 invoked by uid 22791); 9 Jun 2010 21:00:18 -0000 X-SWARE-Spam-Status: No, hits=-0.5 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp.EMBL-Hamburg.DE (HELO smtp.EMBL-Hamburg.DE) (192.109.31.26) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 09 Jun 2010 21:00:09 +0000 Received: from silence.localnet (d152055.adsl.hansenet.de [80.171.152.55]) (authenticated bits=0) by smtp.EMBL-Hamburg.DE (8.13.8/8.13.8/Debian-2) with ESMTP id o59KxTTY010908 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 9 Jun 2010 22:59:32 +0200 From: Daniel Franke To: fortran@gcc.gnu.org Subject: [patch, fortran] PR44347 - ensure scalar arguments for selected_real_kind Date: Wed, 9 Jun 2010 22:59:24 +0200 User-Agent: KMail/1.13.2 (Linux/2.6.32-22-generic; KDE/4.4.2; i686; ; ) Cc: gcc-patches@gcc.gnu.org MIME-Version: 1.0 Message-Id: <201006092259.24398.franke@embl-hamburg.de> X-EMBL-Hamburg-Mailsystem-MailScanner: Found to be clean X-EMBL-Hamburg-Mailsystem-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-1.8, required 5, autolearn=not spam, ALL_TRUSTED -1.80) 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 Pretty obvious. gcc/fortran: 2010-06-09 Daniel Franke PR fortran/44347 * check.c (gfc_check_selected_real_kind): Verify that the actual arguments are scalar. gcc/testsuite: 2010-06-09 Daniel Franke PR fortran/44347 * gfortran.dg/selected_real_kind_1.f90: New. Regression tested on i686-pc-linux-gnu. Ok for trunk (accepts-invalid)? 4.5 (ICE)? Daniel Index: check.c =================================================================== --- check.c (revision 160504) +++ check.c (working copy) @@ -2930,11 +2930,23 @@ gfc_check_selected_real_kind (gfc_expr * return FAILURE; } - if (p != NULL && type_check (p, 0, BT_INTEGER) == FAILURE) - return FAILURE; + if (p) + { + if (type_check (p, 0, BT_INTEGER) == FAILURE) + return FAILURE; - if (r != NULL && type_check (r, 1, BT_INTEGER) == FAILURE) - return FAILURE; + if (scalar_check (p, 0) == FAILURE) + return FAILURE; + } + + if (r) + { + if (type_check (r, 1, BT_INTEGER) == FAILURE) + return FAILURE; + + if (scalar_check (r, 1) == FAILURE) + return FAILURE; + } return SUCCESS; }