From patchwork Wed Nov 10 17:12:42 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 70651 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 E61F0B70F1 for ; Thu, 11 Nov 2010 04:12:57 +1100 (EST) Received: (qmail 3049 invoked by alias); 10 Nov 2010 17:12:54 -0000 Received: (qmail 3031 invoked by uid 22791); 10 Nov 2010 17:12:52 -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; Wed, 10 Nov 2010 17:12:46 +0000 Received: from [192.168.178.22] (port-92-204-76-125.dynamic.qsc.de [92.204.76.125]) by mx01.qsc.de (Postfix) with ESMTP id 0698B3DC19; Wed, 10 Nov 2010 18:12:43 +0100 (CET) Message-ID: <4CDAD28A.6040503@net-b.de> Date: Wed, 10 Nov 2010 18:12:42 +0100 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101026 SUSE/3.1.6 Thunderbird/3.1.6 MIME-Version: 1.0 To: gcc patches , gfortran Subject: [Patch, Fortran] bessel_7.f90, CLASS in SEQUENCE, MOVE_ALLOC is pure (PR 46223, 46244, 46411) 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 Hi all, the attached patches fix a couple of minor issues. a) PR 46223: bessel_7.f90 fails on s960; I simply have bumped one epsilon by 1. b) A polymorphic component (CLASS) in a BIND(C)/SEQUENCE type is not allowed. The patch adds diagnostic for this and fixes thus comment 7 to 9 of PR 496244. c) MOVE_ALLOC is a "pure subroutine". However, it was rejected as impure as the check only looked whether the procedure is elemental. (Elemental implies pure.) The check is now fixed; I also have updated documentation. Build and regtested on x86-64-linux. OK for the trunk? Tobias 2010-11-10 Tobias Burnus PR fortran/46411 * intrinsic.c (gfc_intrinsic_sub_interface): Check for attr.pure and not for attr.elemental. * intrinsic.texi (move_alloc): Document as being pure. 2010-11-10 Tobias Burnus PR fortran/46411 * gfortran.dg/intrinsic_7.f90: New. diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index f7f0e05..d17544c 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -4193,7 +4193,7 @@ gfc_intrinsic_sub_interface (gfc_code *c, int error_flag) c->resolved_sym->attr.elemental = isym->elemental; } - if (gfc_pure (NULL) && !isym->elemental) + if (gfc_pure (NULL) && !isym->pure) { gfc_error ("Subroutine call to intrinsic '%s' at %L is not PURE", name, &c->loc); diff --git a/gcc/fortran/intrinsic.texi b/gcc/fortran/intrinsic.texi index 09f5278..3b81c2d 100644 --- a/gcc/fortran/intrinsic.texi +++ b/gcc/fortran/intrinsic.texi @@ -8977,7 +8977,7 @@ end program Fortran 2003 and later @item @emph{Class}: -Subroutine +Pure subroutine @item @emph{Syntax}: @code{CALL MOVE_ALLOC(FROM, TO)} diff --git a/gcc/testsuite/gfortran.dg/intrinsic_7.f90 b/gcc/testsuite/gfortran.dg/intrinsic_7.f90 new file mode 100644 index 0000000..69bca66 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/intrinsic_7.f90 @@ -0,0 +1,13 @@ +! { dg-do compile } +! +! PR fortran/46411 +! +! MOVE_ALLOC and other non-elemental but pure +! procedures where regarded as impure. +! + +pure subroutine test() + integer, allocatable :: a, b + allocate(a,b) + call move_alloc(a,b) +end subroutine test