This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/46484] [4.5/4.6 Regression] Should reject ALLOCATED(non-variable expression )


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]