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/36058] New: Not allowing pointers to derived types in COMMON


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


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