This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/46484] [4.5/4.6 Regression] Should reject ALLOCATED(non-variable expression )
- From: "burnus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 15 Nov 2010 17:42:59 +0000
- Subject: [Bug fortran/46484] [4.5/4.6 Regression] Should reject ALLOCATED(non-variable expression )
- Auto-submitted: auto-generated
- References: <bug-46484-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46484
--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> 2010-11-15 17:41:19 UTC ---
(In reply to comment #3)
> I think you may have trimmed too much of the condition.
> || (e->expr_type == EXPR_FUNCTION
> && e->symtree->n.sym->result == e->symtree->n.sym))
> Doesn't the second part apply to RESULT variables, ie.,
> funtion foo(x) result(this_should_be_a_variable(not_a function))
> I haven't checked if this where it would apply.
No, it doesn't. That still counts as EXPR_VARIABLE:
function f()
integer, allocatable :: f
print *, allocated(f)
Or at least: It still works with this patch. I find it more interesting that
external proc
print *, loc(proc)
still works.
Actually, the patch is incomplete as the following program still compiles:
integer, allocatable :: x
print *, allocated(f) ! <<< invalid, "f" is not a variable
contains
function f()
integer, allocatable :: f
print *, loc(f)
print *, allocated(f)
end function
end
I will update the patch - to reject the code above but such that it still
allows "loc(proc_name)".