public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/36058]  New: Not allowing pointers to derived types in COMMON
@ 2008-04-27  4:25 w6ws at earthlink dot net
  2008-04-27  8:01 ` [Bug fortran/36058] " burnus at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: w6ws at earthlink dot net @ 2008-04-27  4:25 UTC (permalink / raw)
  To: gcc-bugs

Gfortran is not allowing pointers to certain derived types to reside in COMMON.
 While there are constraints for derived type objects themselves (ref section
5.5.2 of F2003), there do not appear to be constraints on pointers to them.  So
it seems that gfortran is not considering 'pointeredness' when applying the
constraint checks in 5.5.2.

$ cat commonptr.f90
subroutine commonptr ()
  implicit none

  type wws_t
    integer :: x = 1, y = 2, z = 3
  end type

  type (wws_t), pointer :: my_wwsptr
  common /block/ my_wwsptr

  allocate (my_wwsptr)
  my_wwsptr = wws_t (3, 4, 5)

end subroutine
$
$ gfortran --version
GNU Fortran (GCC) 4.3.0 20071222 (experimental) [trunk revision 127783]
Copyright (C) 2007 Free Software Foundation, Inc.

GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING

$ gfortran -c commonptr.f90
commonptr.f90:8.36:

  type (wws_t), pointer :: my_wwsptr
                                   1
Error: Derived type variable 'my_wwsptr' in COMMON at (1) has neither the
SEQUENCE nor the BIND(C) attribute
commonptr.f90:8.36:

  type (wws_t), pointer :: my_wwsptr
                                   1
Error: Derived type variable 'my_wwsptr' in COMMON at (1) may not have default
initializer
$


-- 
           Summary: Not allowing pointers to derived types in COMMON
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: w6ws at earthlink dot net


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


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

end of thread, other threads:[~2008-04-29  5:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-27  4:25 [Bug fortran/36058] New: Not allowing pointers to derived types in COMMON w6ws at earthlink dot net
2008-04-27  8:01 ` [Bug fortran/36058] " burnus at gcc dot gnu dot org
2008-04-27 13:24 ` w6ws at earthlink dot net
2008-04-27 15:31 ` burnus at gcc dot gnu dot org
2008-04-29  5:22 ` 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).