From patchwork Fri Mar 2 09:35:02 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 144167 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 CD3991007D3 for ; Fri, 2 Mar 2012 20:35:26 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1331285727; h=Comment: DomainKey-Signature:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=laVP9EU N0nbvX9u8DPOXLhpAJ38=; b=rc69K7e/xGfaVe1y/HT6HVKOAM/eEIgCd2PbsIZ pgMkRrZpn/moVAFt8PtqqJjFJeCyzKCANAkdUVEUHALytYV8p7X7gidXXTOUH+Qb tCuZRlTyNkukPdR1hENKFrQDRBEUbHEIENuJ8Ds/DxvgvKk1IRjkf5g7MexXdUtp qpn8= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=Ec4YGBwIJliYRaRR4HNGPRjj4e/GIN+U1q6aLDID6SA9+FR82V+yF/WMfEEh1N K/Dl8uI3iusB254ICkt1kC0jiYFHn1S4La6jvxQTHDhmiV/eXdm2bBsZ0kXzI2LW FSJ2Kc6nYR0HTRZtolxOcFJvQSbJR3Ll/tckWKQBWB7ME=; Received: (qmail 25426 invoked by alias); 2 Mar 2012 09:35:20 -0000 Received: (qmail 25335 invoked by uid 22791); 2 Mar 2012 09:35:19 -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, 02 Mar 2012 09:35:05 +0000 Received: from [192.168.178.22] (port-92-204-104-94.dynamic.qsc.de [92.204.104.94]) by mx02.qsc.de (Postfix) with ESMTP id EF66C1E5AF; Fri, 2 Mar 2012 10:35:03 +0100 (CET) Message-ID: <4F509446.3010007@net-b.de> Date: Fri, 02 Mar 2012 10:35:02 +0100 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.2) Gecko/20120215 Thunderbird/10.0.2 MIME-Version: 1.0 To: gcc patches , gfortran Subject: [Patch, Fortran] PR52452 [4.5-4.7 Regr.] Intrinsic wrongly rejected 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 There is a 4.5 to 4.7 regression for those (vendor) intrinsic procedures, which can exists as both subroutine and as function. Example: INTRINSIC :: etime CALL etime(tarray, result) Here, the "etime" gets marked as attr.subroutine, but later in resolve_intrinsics, it is mapped to the intrinsic function "etime". But then the compiler complains: Error: FUNCTION attribute conflicts with SUBROUTINE attribute in 'etime' at (1) Solution: Don't search for the function, if we have a subroutine. (For some reasons, it works without "INTRINSIC :: etime".) Build and regtested on x86-64-linux. OK for the trunk - and the 4.5 to 4.6 branches? Tobias PS: I will ask for RM approval if this patch gets approved after (today's?) RC1 release. 2012-03-02 Tobias Burnus PR fortran/52452 * resolve.c (resolve_intrinsic): Don't search for a function if we know that it is a subroutine. 2012-03-02 Tobias Burnus PR fortran/52452 * gfortran.dg/intrinsic_8.f90: New. diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 4dcf9b1..049a926 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -1496,7 +1498,7 @@ resolve_intrinsic (gfc_symbol *sym, locus *loc) if (sym->intmod_sym_id) isym = gfc_intrinsic_function_by_id ((gfc_isym_id) sym->intmod_sym_id); - else + else if (!sym->attr.subroutine) isym = gfc_find_function (sym->name); if (isym) --- /dev/null 2012-03-02 07:37:33.883806634 +0100 +++ gcc/gcc/testsuite/gfortran.dg/intrinsic_8.f90 2012-03-02 08:59:51.000000000 +0100 @@ -0,0 +1,23 @@ +! { dg-do compile } +! +! PR fortran/52452 +! +! Contributed by Roger Ferrer Ibanez +! +PROGRAM test_etime + IMPLICIT NONE + INTRINSIC :: etime + REAL(4) :: tarray(1:2) + REAL(4) :: result + + CALL etime(tarray, result) +END PROGRAM test_etime + +subroutine test_etime2 + IMPLICIT NONE + INTRINSIC :: etime + REAL(4) :: tarray(1:2) + REAL(4) :: result + + result = etime(tarray) +END subroutine test_etime2