public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/40054]  New: Fortran 2008: Pointer functions as lvalue
@ 2009-05-07  7:55 janus at gcc dot gnu dot org
  2009-05-07  8:08 ` [Bug fortran/40054] " burnus at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-05-07  7:55 UTC (permalink / raw)
  To: gcc-bugs

See section 6.2 in ftp://ftp.nag.co.uk/sc22wg5/N1701-N1750/N1729.pdf.

In principle functions which return a pointer work already (even with procedure
pointers). AFAICS, the only thing missing is using these functions as lvalue,
as in this example:


real, dimension(1:100), target :: array
real, pointer :: p

array(5) = 0.7
print *,storage(5)

p => storage(3)
p = 0.5
print *,p

storage(5) = 0.5  ! Error: 'storage' at (1) is not a variable

contains

  function storage(key) result(loc)
    integer, intent(in) :: key
    real, pointer :: loc
    loc => array(key)
  end function

end


-- 
           Summary: Fortran 2008: Pointer functions as lvalue
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: janus at gcc dot gnu dot org
OtherBugsDependingO 39627
             nThis:


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


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

* [Bug fortran/40054] Fortran 2008: Pointer functions as lvalue
  2009-05-07  7:55 [Bug fortran/40054] New: Fortran 2008: Pointer functions as lvalue janus at gcc dot gnu dot org
@ 2009-05-07  8:08 ` burnus at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-05-07  8:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2009-05-07 08:07 -------
In the standard:

   R602 variable  is  designator
                  or  expr
   C602 (R602) expr shall be a reference to a function that has a pointer
               result."

Which can then be used in assignment statements:

   R732 assignment-stmt  is  variable = expr

   If the variable is a pointer, it shall be associated with a definable
   target such that the type, type parameters, and shape of the target
   and expr conform.


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-05-07 08:07:58
               date|                            |


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


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

end of thread, other threads:[~2009-05-07  8:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-07  7:55 [Bug fortran/40054] New: Fortran 2008: Pointer functions as lvalue janus at gcc dot gnu dot org
2009-05-07  8:08 ` [Bug fortran/40054] " burnus 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).