public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/44879] New: MOVE_ALLOC rejects FROM= which is a function result
@ 2010-07-08 22:04 burnus at gcc dot gnu dot org
2010-07-09 5:47 ` [Bug fortran/44879] " burnus at gcc dot gnu dot org
2010-07-09 6:03 ` kargl at gcc dot gnu dot org
0 siblings, 2 replies; 3+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-07-08 22:04 UTC (permalink / raw)
To: gcc-bugs
>From Reinhold Bader at http://j3-fortran.org/pipermail/j3/2010-July/003653.html
The following program is rejected with:
call move_alloc(extd(i1), i1)
1
Error: 'from' argument of 'move_alloc' intrinsic at (1) must be a variable
The standard does not say anything about "variable":
"FROM may be of any type and rank. It shall be allocatable. It is an INTENT
(INOUT) argument."
The check is done at gfc_check_move_alloc. It might be sufficient to replace:
if (variable_check (from, 0) == FAILURE)
return FAILURE;
by
if (from->expr_type != EXPR_VARIABLE && ... != EXPR_FUNCTION)
{ gfc_error ...; return FAILURE }
The rest (e.g. gfc_variable_attr) can deal with it.
program mvall_01
implicit none
integer, parameter :: n1 = 100, n2 = 2*n1
integer, allocatable :: i1(:)
allocate(i1(n1))
i1 = 1
call move_alloc(extd(i1), i1)
print *, i1(1), size(i1)
if (i1(1) /= 2 .or. size(i1) /= 200) call abort()
contains
function extd(in) result(out)
integer, allocatable :: out(:)
integer, intent(in) :: in(:)
allocate(out(2*size(in)))
out = 2
end function
end program
--
Summary: MOVE_ALLOC rejects FROM= which is a function result
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: burnus at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44879
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug fortran/44879] MOVE_ALLOC rejects FROM= which is a function result
2010-07-08 22:04 [Bug fortran/44879] New: MOVE_ALLOC rejects FROM= which is a function result burnus at gcc dot gnu dot org
@ 2010-07-09 5:47 ` burnus at gcc dot gnu dot org
2010-07-09 6:03 ` kargl at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-07-09 5:47 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from burnus at gcc dot gnu dot org 2010-07-09 05:47 -------
As Malcom Cohen points out:
"If a dummy argument has INTENT (OUT) or INTENT (INOUT), the actual argument
shall be definable." (F2008, 12.5.2.4, paragraph 17)
And as "FROM" is a "INTENT(INOUT) argument." (cf. above), it needs to be
definable and thus may not be a function (result). That's exactly what gfortran
checks :-)
Close as invalid.
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44879
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug fortran/44879] MOVE_ALLOC rejects FROM= which is a function result
2010-07-08 22:04 [Bug fortran/44879] New: MOVE_ALLOC rejects FROM= which is a function result burnus at gcc dot gnu dot org
2010-07-09 5:47 ` [Bug fortran/44879] " burnus at gcc dot gnu dot org
@ 2010-07-09 6:03 ` kargl at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: kargl at gcc dot gnu dot org @ 2010-07-09 6:03 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from kargl at gcc dot gnu dot org 2010-07-09 06:02 -------
Is there a testsuite program to check this?
Perhaps, your code should be added so the
correct behavior doesn't get unfixed.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44879
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-07-09 6:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-08 22:04 [Bug fortran/44879] New: MOVE_ALLOC rejects FROM= which is a function result burnus at gcc dot gnu dot org
2010-07-09 5:47 ` [Bug fortran/44879] " burnus at gcc dot gnu dot org
2010-07-09 6:03 ` kargl 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).