public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/46411] New: MOVE_ALLOC wrongly rejected as impure
@ 2010-11-10 13:02 burnus at gcc dot gnu.org
  2010-11-10 13:43 ` [Bug fortran/46411] " mikael at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: burnus at gcc dot gnu.org @ 2010-11-10 13:02 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: MOVE_ALLOC wrongly rejected as impure
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org


Reported in #gfortran's IRC channel.

MOVE_ALLOC is pure but rejected in PURE programs:

"13.7.118 MOVE_ALLOC (FROM, TO)"
"Class. Pure subroutine."


  call move_alloc(a,b)
       1
Error: Subroutine call to 'move_alloc' at (1) is not PURE



pure subroutine test()
  integer, allocatable :: a, b
  allocate(a,b)
  call move_alloc(a,b)
end subroutine test



Untested patch.

Actually, I am not sure that CLASS_INQUIRY and  CLASS_TRANSFORMATIONAL
functions are PURE. Currently, all functions which are not IMPURE are marked as
PURE.


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)}


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

end of thread, other threads:[~2011-03-12 10:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-10 13:02 [Bug fortran/46411] New: MOVE_ALLOC wrongly rejected as impure burnus at gcc dot gnu.org
2010-11-10 13:43 ` [Bug fortran/46411] " mikael at gcc dot gnu.org
2010-11-10 17:55 ` burnus at gcc dot gnu.org
2010-11-10 18:04 ` burnus at gcc dot gnu.org
2010-12-27  0:30 ` dfranke at gcc dot gnu.org
2011-03-12 10:18 ` fxcoudert at gcc dot gnu.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).