public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/50684] New: Incorrect error for move_alloc on intent(in) pointer
@ 2011-10-10 13:23 msteghofer at cistib dot upf.edu
  2011-10-12 19:53 ` [Bug fortran/50684] Incorrect error for move_alloc on element inside " janus at gcc dot gnu.org
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: msteghofer at cistib dot upf.edu @ 2011-10-10 13:23 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 50684
           Summary: Incorrect error for move_alloc on intent(in) pointer
    Classification: Unclassified
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: msteghofer@cistib.upf.edu


Created attachment 25452
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25452
Code to reproduce the behaviour

Bug that was originally posted as additional comment to bug 50570, but turned
out to be a different issue:

The code in the attachment is calling the function move_alloc with something
inside an intent(in) pointer as actual argument and gives the following error
message:

bug.f90:22.20:
    CALL MOVE_ALLOC(POINTER_INTENT_IN_VARIABLE%VALUE, LOCAL_VALUE)
                    1
Error: 'from' argument of 'move_alloc' intrinsic at (1) cannot be INTENT(IN)

I'm not sure about what the Fortran standard says, but I don't think that
giving this error is a desired behaviour because:
* According to documentation of other compilers the code should compile:
http://publib.boulder.ibm.com/infocenter/comphelp/v111v131/topic/com.ibm.xlf131.aix.doc/language_ref/intent.html
(section "Rules", subsection about pointer dummy arguments)
* If INTENT(IN) really tries to protect the *members* (not the pointer itself)
of the derived type from being changed (that's the only scenario in which this
behaviour would make sense), then it's not doing its job: Copying the pointer
to a local variable I'm able to change them, as the example
"POINTER_INTENT_IN_BUG_WORKING" in the attached code shows.

Notes about the attachment:
Subroutine POINTER_INTENT_IN_BUG_FAILING contains the failing code.
Subroutien POINTER_INTENT_IN_BUG_WORKING contains an alternative code that does
the same thing, but compiles (to show that the behaviour of gfortran doesn't
make sense as protection, either).


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

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

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-10 13:23 [Bug fortran/50684] New: Incorrect error for move_alloc on intent(in) pointer msteghofer at cistib dot upf.edu
2011-10-12 19:53 ` [Bug fortran/50684] Incorrect error for move_alloc on element inside " janus at gcc dot gnu.org
2011-10-12 20:31 ` [Bug fortran/50684] [4.6/4.7 Regression] " janus at gcc dot gnu.org
2011-10-12 20:45 ` janus at gcc dot gnu.org
2011-10-12 20:55 ` burnus at gcc dot gnu.org
2011-10-12 21:18 ` janus at gcc dot gnu.org
2011-10-12 21:42 ` burnus at gcc dot gnu.org
2011-10-12 21:53 ` burnus at gcc dot gnu.org
2011-10-12 22:07 ` janus at gcc dot gnu.org
2011-10-13  7:18 ` burnus at gcc dot gnu.org
2011-10-13 12:28 ` janus at gcc dot gnu.org
2011-10-13 12:32 ` janus at gcc dot gnu.org
2011-10-26 18:16 ` jakub at gcc dot gnu.org
2011-10-27 10:37 ` rguenth at gcc dot gnu.org
2011-12-03 11:31 ` burnus at gcc dot gnu.org
2011-12-03 12:58 ` burnus at gcc dot gnu.org
2011-12-03 12:59 ` burnus 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).