public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/45197]  New: [F2008] Allow IMPURE elemental procedures
@ 2010-08-05 15:02 domob at gcc dot gnu dot org
  2010-08-05 15:03 ` [Bug fortran/45197] " domob at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: domob at gcc dot gnu dot org @ 2010-08-05 15:02 UTC (permalink / raw)
  To: gcc-bugs

In Fortran 2008, an ELEMENTAL procedure needs not necessarily be PURE. 
Procedures can now be specified to be IMPURE, and if this is applied to an
ELEMENTAL procedure it is not automatically PURE as it otherwise is.

For instance, the following code will fill b(n) with cumulative sum of elements
in array element order and thus print (/ 1, 3, 6, 10, 15 /):

PROGRAM main
  IMPLICIT NONE

  INTEGER, PARAMETER :: n = 5
  INTEGER :: i
  REAL :: a(n), b(n), s

  a = (/ (i, i = 1, n) /)
  s = 0.0
  b = accumulate (a, s)

  PRINT *, b

CONTAINS

  IMPURE ELEMENTAL FUNCTION accumulate (a, s)
    REAL, INTENT(IN) :: a
    REAL, INTENT(INOUT) :: s
    REAL :: accumulate

    s = s + a
    accumulate = s
  END FUNCTION accumulate

END PROGRAM main


-- 
           Summary: [F2008] Allow IMPURE elemental procedures
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: domob at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45197


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/45197] [F2008] Allow IMPURE elemental procedures
  2010-08-05 15:02 [Bug fortran/45197] New: [F2008] Allow IMPURE elemental procedures domob at gcc dot gnu dot org
@ 2010-08-05 15:03 ` domob at gcc dot gnu dot org
  2010-08-15 15:28 ` domob at gcc dot gnu dot org
  2010-08-15 16:26 ` domob at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: domob at gcc dot gnu dot org @ 2010-08-05 15:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from domob at gcc dot gnu dot org  2010-08-05 15:02 -------
Mine.


-- 

domob at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |domob at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-08-05 15:02:59
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45197


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/45197] [F2008] Allow IMPURE elemental procedures
  2010-08-05 15:02 [Bug fortran/45197] New: [F2008] Allow IMPURE elemental procedures domob at gcc dot gnu dot org
  2010-08-05 15:03 ` [Bug fortran/45197] " domob at gcc dot gnu dot org
@ 2010-08-15 15:28 ` domob at gcc dot gnu dot org
  2010-08-15 16:26 ` domob at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: domob at gcc dot gnu dot org @ 2010-08-15 15:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from domob at gcc dot gnu dot org  2010-08-15 15:28 -------
Subject: Bug 45197

Author: domob
Date: Sun Aug 15 15:28:10 2010
New Revision: 163261

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=163261
Log:
2010-08-15  Daniel Kraft  <d@domob.eu>

        PR fortran/45197
        * decl.c (gfc_match_prefix): Match IMPURE prefix and mark ELEMENTAL
        routines not IMPURE also as PURE.
        * intrinsic.c (enum klass): New class `CLASS_PURE' and renamed
        `NO_CLASS' in `CLASS_IMPURE'.
        (add_sym): Set symbol-attributes `pure' and `elemental' correctly.
        (add_sym_0s): Renamed `NO_CLASS' in `CLASS_IMPURE'.
        (add_functions): Ditto.
        (add_subroutines): Ditto and mark `MOVE_ALLOC' as CLASS_PURE.
        * resolve.c (gfc_pure): Do not treat ELEMENTAL as automatically PURE.
        (resolve_formal_arglist): Check that arguments to ELEMENTAL procedures
        are not ALLOCATABLE and have their INTENT specified.

2010-08-15  Daniel Kraft  <d@domob.eu>

        PR fortran/45197
        * gfortran.dg/elemental_args_check_3.f90: New test.
        * gfortran.dg/impure_1.f08: New test.
        * gfortran.dg/impure_2.f08: New test.
        * gfortran.dg/impure_3.f90: New test.
        * gfortran.dg/typebound_proc_6.f03: Changed expected error message.

Added:
    trunk/gcc/testsuite/gfortran.dg/elemental_args_check_3.f90
    trunk/gcc/testsuite/gfortran.dg/impure_1.f08
    trunk/gcc/testsuite/gfortran.dg/impure_2.f08
    trunk/gcc/testsuite/gfortran.dg/impure_3.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/decl.c
    trunk/gcc/fortran/intrinsic.c
    trunk/gcc/fortran/resolve.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/typebound_proc_6.f03


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45197


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/45197] [F2008] Allow IMPURE elemental procedures
  2010-08-05 15:02 [Bug fortran/45197] New: [F2008] Allow IMPURE elemental procedures domob at gcc dot gnu dot org
  2010-08-05 15:03 ` [Bug fortran/45197] " domob at gcc dot gnu dot org
  2010-08-15 15:28 ` domob at gcc dot gnu dot org
@ 2010-08-15 16:26 ` domob at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: domob at gcc dot gnu dot org @ 2010-08-15 16:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from domob at gcc dot gnu dot org  2010-08-15 16:26 -------
Fixed.


-- 

domob at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45197


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-08-15 16:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-05 15:02 [Bug fortran/45197] New: [F2008] Allow IMPURE elemental procedures domob at gcc dot gnu dot org
2010-08-05 15:03 ` [Bug fortran/45197] " domob at gcc dot gnu dot org
2010-08-15 15:28 ` domob at gcc dot gnu dot org
2010-08-15 16:26 ` domob at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).