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/51208] [OOP] ALLOCATE with SOURCE= or MOLD=: Diagnose if variable occurs twice


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

--- Comment #7 from Steve Kargl <sgk at troutmask dot apl.washington.edu> 2013-01-07 23:36:50 UTC ---
On Mon, Jan 07, 2013 at 11:16:13PM +0000, dominiq at lps dot ens.fr wrote:
> (In reply to comment #2)
> > Or extremely complicated:
> >
> >   integer, pointer :: ptr
> >   allocate (ptr, stat=f())
> > contains
> >   function f()
> >     integer, pointer :: f
> >     f => ptr
> >   end function
> > end
> >
> > (Recall that a pointer-function result is a variable in Fortran 2008.)
> 
> At revision 194996, I get
> 
>   allocate (ptr, stat=f())
>                        1
> Error: Syntax error in ALLOCATE statement at (1)
> 
> Is this another bug or is the error correct?
> 

An error is in order, but I'm not sure if the above is
the correct error.  From F08,

    The stat-variable shall not be allocated or deallocated within the
    ALLOCATE or DEALLOCATE statement in which it appears; nor shall it
    depend on the value, bounds, deferred type parameters, allocation
    status, or association status of any allocate-object in that statement.

I haven't verified the statement that "a pointer-function is a variable",
but assuming that this is true, you have 

   allocate(ptr, stat=ptr)


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