public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/36592]  New: F2003: Procedure pointer in COMMON
@ 2008-06-21 19:48 burnus at gcc dot gnu dot org
  2008-09-22 16:51 ` [Bug fortran/36592] " janus at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-06-21 19:48 UTC (permalink / raw)
  To: gcc-bugs

Procedure pointers in COMMON are currently rejected (gfc_error), but they are
valid and should thus be supported.

"5.5.2 COMMON statement"
"R558 common-block-object is variable-name [ ( explicit-shape-spec-list ) ]
                          or proc-pointer-name"

Test program (hopefully correct):

subroutine one()
 implicit none
 integer :: a,b
 procedure(real), pointer :: p
 common /com/ a,b
 if(a /= 5 .or. b /= -9) call abort()
 if(p(0.0)/= 1.0) call abort
end subroutine one

program main
 implicit none
 integer  x
 integer  y
 intrinsic cos
 external func1
 pointer  func1
 procedure(real), pointer :: func2
 common /com/ x,func1,y,func2
 x = 5
 y = -9
 func1 => cos
 func2 => cos
 call one()
end program main


First patch:

--- symbol.c    (revision 136801)
+++ symbol.c    (working copy)
@@ -1114,7 +1131,7 @@ gfc_add_in_common (symbol_attribute *att
  if (check_conflict (attr, name, where) == FAILURE)
    return FAILURE;

-  if (attr->flavor == FL_VARIABLE)
+  if (attr->flavor == FL_VARIABLE || attr->proc_pointer)
    return SUCCESS;

  return gfc_add_flavor (attr, FL_VARIABLE, name, where);


Actually, there is probably the following missing as well:
" || (attr->pointer && attr->external && attr->if_source != IFSRC_IFBODY)"

But this is not enough and produces tons of ICEs.


-- 
           Summary: F2003: Procedure pointer in COMMON
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org
 BugsThisDependsOn: 32580


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


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

end of thread, other threads:[~2008-09-30 15:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-21 19:48 [Bug fortran/36592] New: F2003: Procedure pointer in COMMON burnus at gcc dot gnu dot org
2008-09-22 16:51 ` [Bug fortran/36592] " janus at gcc dot gnu dot org
2008-09-22 20:24 ` burnus at gcc dot gnu dot org
2008-09-23 12:45 ` janus at gcc dot gnu dot org
2008-09-29  9:41 ` janus at gcc dot gnu dot org
2008-09-30 15:22 ` burnus at gcc dot gnu dot org
2008-09-30 15:24 ` 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).