From patchwork Thu May 12 14:19:00 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 95319 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 3D3B5B6FC3 for ; Fri, 13 May 2011 00:19:38 +1000 (EST) Received: (qmail 21836 invoked by alias); 12 May 2011 14:19:36 -0000 Received: (qmail 21816 invoked by uid 22791); 12 May 2011 14:19:35 -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 mx01.qsc.de (HELO mx01.qsc.de) (213.148.129.14) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 12 May 2011 14:19:03 +0000 Received: from [192.168.178.22] (port-92-204-45-85.dynamic.qsc.de [92.204.45.85]) by mx01.qsc.de (Postfix) with ESMTP id EE3203CD47; Thu, 12 May 2011 16:19:01 +0200 (CEST) Message-ID: <4DCBEC54.60801@net-b.de> Date: Thu, 12 May 2011 16:19:00 +0200 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.14) Gecko/20110221 SUSE/3.1.8 Thunderbird/3.1.8 MIME-Version: 1.0 To: gcc patches , gfortran Subject: [Patch,Fortran] Resolve intrinsic module-procs only once 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 If an intrinsic module proc [such as ISO_Fortran_env's compiler_options()] is resolved multiple times, with -Wall a warning is printed, claiming that one has manually typed an intrinsic. The fix is to avoid resolving the proc multiple times. Note: Typing of use-associated symbols will always produce an error, thus, the warning is unreachable and not needed for intrinsics originating from modules. Build and regtested on x86-64-linux. OK for the trunk? Tobias 2011-05-12 Tobias Burnus PR fortran/48972 * resolve.c (resolve_intrinsic): Don't resolve module intrinsics multiple times. 2011-05-12 Tobias Burnus PR fortran/48972 * gfortran.dg/iso_c_binding_compiler_3.f90: New. diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index a19b103..3483bc7 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -1441,6 +1441,10 @@ resolve_intrinsic (gfc_symbol *sym, locus *loc) if (sym->formal) return SUCCESS; + /* Already resolved. */ + if (sym->from_intmod && sym->ts.type != BT_UNKNOWN) + return SUCCESS; + /* We already know this one is an intrinsic, so we don't call gfc_is_intrinsic for full checking but rather use gfc_find_function and gfc_find_subroutine directly to check whether it is a function or --- /dev/null 2011-05-12 07:35:17.079892192 +0200 +++ gcc/gcc/testsuite/gfortran.dg/iso_c_binding_compiler_3.f90 2011-05-12 13:51:04.000000000 +0200 @@ -0,0 +1,27 @@ +! { dg-do compile } +! { dg-options "-Wall" } +! +! PR fortran/45823 +! +! We used to warn about +! "Type specified for intrinsic function" for this file +! + +use iso_c_binding +use iso_Fortran_env +implicit none +intrinsic sin +real :: x = 3.4 +print *, sin(x), c_sizeof(c_int), compiler_options(), compiler_version() +end + + +module test_mod + use iso_fortran_env +end module test_mod + +subroutine test +use test_mod +end subroutine test + +! { dg-final { cleanup-modules "test_mod" } }