From patchwork Fri Apr 29 21:45:55 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 93481 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 E4AB7B6F44 for ; Sat, 30 Apr 2011 07:46:18 +1000 (EST) Received: (qmail 30808 invoked by alias); 29 Apr 2011 21:46:15 -0000 Received: (qmail 30789 invoked by uid 22791); 29 Apr 2011 21:46:13 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mx02.qsc.de (HELO mx02.qsc.de) (213.148.130.14) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 29 Apr 2011 21:45:58 +0000 Received: from [192.168.178.22] (port-92-204-100-38.dynamic.qsc.de [92.204.100.38]) by mx02.qsc.de (Postfix) with ESMTP id D6C471E4C7; Fri, 29 Apr 2011 23:45:56 +0200 (CEST) Message-ID: <4DBB3193.1020200@net-b.de> Date: Fri, 29 Apr 2011 23:45:55 +0200 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.13) Gecko/20101206 SUSE/3.1.7 Thunderbird/3.1.7 MIME-Version: 1.0 To: gcc patches , gfortran Subject: [Patch, Fortran] PR 48800 - fix "IMPORT :: symbol" 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 Nearly obvious patch. Build and regtested on x86-64-linux. OK for the trunk? Tobias 2011-04-30 Tobias Burnus PR fortran/48800 * decl.c (gfc_match_import): Don't try to find the symbol if already found. 2011-04-30 Tobias Burnus PR fortran/48800 * gfortran.dg/interface_36.f90: New. diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 9901fb1..dfbca29 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -2995,7 +2995,7 @@ gfc_match_import (void) gfc_error ("Type name '%s' at %C is ambiguous", name); return MATCH_ERROR; } - else if (gfc_current_ns->proc_name->ns->parent != NULL + else if (!sym && gfc_current_ns->proc_name->ns->parent != NULL && gfc_find_symbol (name, gfc_current_ns->proc_name->ns->parent, 1, &sym)) --- /dev/null 2011-04-29 18:38:34.095891993 +0200 +++ gcc/gcc/testsuite/gfortran.dg/interface_36.f90 2011-04-29 19:10:43.000000000 +0200 @@ -0,0 +1,28 @@ +! { dg-do compile } +! +! PR fortran/48800 +! +! Contributed by Daniel Carrera +! + pure function runge_kutta_step(t, r_, dr, h) result(res) + real, intent(in) :: t, r_(:), h + real, dimension(:), allocatable :: k1, k2, k3, k4, res + integer :: N + + interface + pure function dr(t, r_) ! { dg-error "cannot have a deferred shape" } + real, intent(in) :: t, r_(:) + real :: dr(:) + end function + end interface + + N = size(r_) + allocate(k1(N),k2(N),k3(N),k4(N),res(N)) + + k1 = dr(t, r_) + k2 = dr(t + h/2, r_ + k1*h/2) + k3 = dr(t + h/2, r_ + k2*h/2) + k4 = dr(t + h , r_ + k3*h) + + res = r_ + (k1 + 2*k2 + 2*k3 + k4) * h/6 + end function