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

* [Bug fortran/46411] MOVE_ALLOC wrongly rejected as impure
  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 ` mikael at gcc dot gnu.org
  2010-11-10 17:55 ` burnus at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: mikael at gcc dot gnu.org @ 2010-11-10 13:43 UTC (permalink / raw)
  To: gcc-bugs

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

Mikael Morin <mikael at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikael at gcc dot gnu.org

--- Comment #1 from Mikael Morin <mikael at gcc dot gnu.org> 2010-11-10 13:43:03 UTC ---
Patch pre-approved. 

(In reply to comment #0)
> Actually, I am not sure that CLASS_INQUIRY and  CLASS_TRANSFORMATIONAL
> functions are PURE. 
They are: 13.1, §2, last sentence:
All standard intrinsic functions are pure.
Some GNU extensions are not, but they are marked as CLASS_IMPURE.


> Currently, all functions which are not IMPURE are marked as
> PURE.
... since Jerry's patch from yesterday. ;-)
But it's not a regression. :-)


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

* [Bug fortran/46411] MOVE_ALLOC wrongly rejected as impure
  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
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu.org @ 2010-11-10 17:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2010-11-10 17:55:14 UTC ---
Fixed on the trunk.

I was asked in #gfortran to backport it to 4.5. I thus leave it open. The
backport probably requires that non-IMPURE variables are marked as attr.pure
(cf. comment 1). On 4.5 CLASS_IMPURE ('impure' is F2008) was called CLASS_NONE.

This patch is http://gcc.gnu.org/ml/fortran/2010-11/msg00196.html
the comment 1 patch is part of
http://gcc.gnu.org/ml/fortran/2010-11/msg00186.html


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

* [Bug fortran/46411] MOVE_ALLOC wrongly rejected as impure
  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
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu.org @ 2010-11-10 18:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2010-11-10 18:04:10 UTC ---
Author: burnus
Date: Wed Nov 10 18:04:04 2010
New Revision: 166550

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=166550
Log:
2010-11-10  Tobias Burnus  <burnus@net-b.de>

        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  <burnus@net-b.de>

        PR fortran/46411
        * gfortran.dg/intrinsic_7.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/intrinsic_7.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/intrinsic.c
    trunk/gcc/fortran/intrinsic.texi
    trunk/gcc/testsuite/ChangeLog


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

* [Bug fortran/46411] MOVE_ALLOC wrongly rejected as impure
  2010-11-10 13:02 [Bug fortran/46411] New: MOVE_ALLOC wrongly rejected as impure burnus at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  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
  4 siblings, 0 replies; 6+ messages in thread
From: dfranke at gcc dot gnu.org @ 2010-12-27  0:30 UTC (permalink / raw)
  To: gcc-bugs

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

Daniel Franke <dfranke at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2010.12.27 00:30:19
                 CC|                            |dfranke at gcc dot gnu.org
     Ever Confirmed|0                           |1

--- Comment #4 from Daniel Franke <dfranke at gcc dot gnu.org> 2010-12-27 00:30:19 UTC ---
Tobias, is there anything left or can this report be closed?


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

* [Bug fortran/46411] MOVE_ALLOC wrongly rejected as impure
  2010-11-10 13:02 [Bug fortran/46411] New: MOVE_ALLOC wrongly rejected as impure burnus at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2010-12-27  0:30 ` dfranke at gcc dot gnu.org
@ 2011-03-12 10:18 ` fxcoudert at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2011-03-12 10:18 UTC (permalink / raw)
  To: gcc-bugs

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

Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
                 CC|                            |fxcoudert at gcc dot
                   |                            |gnu.org
         Resolution|                            |FIXED
   Target Milestone|---                         |4.6.0

--- Comment #5 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> 2011-03-12 10:18:19 UTC ---
Two months and a half have passed, noone has proposed a backport, and 4.6.0
should be released soon (reducing the incentive for backporting). Thus,
closing. Please reopen if you want to backport.


^ 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).