re PR fortran/47768 (ICE: printing a derived-type variable with proc-pointer components)
authorJanus Weil <janus@gcc.gnu.org>
Fri, 11 Mar 2011 14:13:49 +0000 (15:13 +0100)
committerJanus Weil <janus@gcc.gnu.org>
Fri, 11 Mar 2011 14:13:49 +0000 (15:13 +0100)
2011-03-11  Janus Weil  <janus@gcc.gnu.org>

PR fortran/47768
* module.c (ab_attribute,attr_bits): Add AB_PROC_POINTER_COMP.
(mio_symbol_attribute): Handle attribute 'proc_pointer_comp'.

2011-03-11  Janus Weil  <janus@gcc.gnu.org>

PR fortran/47768
* gfortran.dg/proc_ptr_comp_31.f90: New.

From-SVN: r170871

gcc/fortran/ChangeLog
gcc/fortran/module.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/proc_ptr_comp_31.f90 [new file with mode: 0644]

index a479ef6721010788eadf9ee6d83bd3abf3cf69cb..a0b88054589dde63b8959242808736c0ed4f7f7c 100644 (file)
@@ -1,3 +1,9 @@
+2011-03-11  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/47768
+       * module.c (ab_attribute,attr_bits): Add AB_PROC_POINTER_COMP.
+       (mio_symbol_attribute): Handle attribute 'proc_pointer_comp'.
+
 2011-03-06  Paul Thomas  <pault@gcc.gnu.org>
            Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
index 6f1520c0205eff9d2649035ba7180fda0226c078..923f8c695e408385c37d25d6171c50ebdee420b8 100644 (file)
@@ -1671,8 +1671,9 @@ typedef enum
   AB_POINTER, AB_TARGET, AB_DUMMY, AB_RESULT, AB_DATA,
   AB_IN_NAMELIST, AB_IN_COMMON, AB_FUNCTION, AB_SUBROUTINE, AB_SEQUENCE,
   AB_ELEMENTAL, AB_PURE, AB_RECURSIVE, AB_GENERIC, AB_ALWAYS_EXPLICIT,
-  AB_CRAY_POINTER, AB_CRAY_POINTEE, AB_THREADPRIVATE, AB_ALLOC_COMP,
-  AB_POINTER_COMP, AB_PRIVATE_COMP, AB_VALUE, AB_VOLATILE, AB_PROTECTED,
+  AB_CRAY_POINTER, AB_CRAY_POINTEE, AB_THREADPRIVATE,
+  AB_ALLOC_COMP, AB_POINTER_COMP, AB_PROC_POINTER_COMP, AB_PRIVATE_COMP,
+  AB_VALUE, AB_VOLATILE, AB_PROTECTED,
   AB_IS_BIND_C, AB_IS_C_INTEROP, AB_IS_ISO_C, AB_ABSTRACT, AB_ZERO_COMP,
   AB_IS_CLASS, AB_PROCEDURE, AB_PROC_POINTER, AB_ASYNCHRONOUS, AB_CODIMENSION,
   AB_COARRAY_COMP, AB_VTYPE, AB_VTAB, AB_CONTIGUOUS, AB_CLASS_POINTER,
@@ -1716,6 +1717,7 @@ static const mstring attr_bits[] =
     minit ("ALLOC_COMP", AB_ALLOC_COMP),
     minit ("COARRAY_COMP", AB_COARRAY_COMP),
     minit ("POINTER_COMP", AB_POINTER_COMP),
+    minit ("PROC_POINTER_COMP", AB_PROC_POINTER_COMP),
     minit ("PRIVATE_COMP", AB_PRIVATE_COMP),
     minit ("ZERO_COMP", AB_ZERO_COMP),
     minit ("PROTECTED", AB_PROTECTED),
@@ -1881,6 +1883,8 @@ mio_symbol_attribute (symbol_attribute *attr)
        MIO_NAME (ab_attribute) (AB_ALLOC_COMP, attr_bits);
       if (attr->pointer_comp)
        MIO_NAME (ab_attribute) (AB_POINTER_COMP, attr_bits);
+      if (attr->proc_pointer_comp)
+       MIO_NAME (ab_attribute) (AB_PROC_POINTER_COMP, attr_bits);
       if (attr->private_comp)
        MIO_NAME (ab_attribute) (AB_PRIVATE_COMP, attr_bits);
       if (attr->coarray_comp)
@@ -2027,6 +2031,9 @@ mio_symbol_attribute (symbol_attribute *attr)
            case AB_POINTER_COMP:
              attr->pointer_comp = 1;
              break;
+           case AB_PROC_POINTER_COMP:
+             attr->proc_pointer_comp = 1;
+             break;
            case AB_PRIVATE_COMP:
              attr->private_comp = 1;
              break;
index 48619b6b7e10c914412e9a8afd1d1b1d11c6446e..54d77a6d2535c9f5b6c513f28115de74fd27ca83 100644 (file)
@@ -1,3 +1,8 @@
+2011-03-11  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/47768
+       * gfortran.dg/proc_ptr_comp_31.f90: New.
+
 2011-03-11  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/47278
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_comp_31.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_comp_31.f90
new file mode 100644 (file)
index 0000000..6a5d8c9
--- /dev/null
@@ -0,0 +1,22 @@
+! { dg-do compile }
+!
+! PR 47768: printing a derived-type variable with proc-pointer components
+!
+! Contributed by Arjen Markus <arjen.markus895@gmail.com>
+
+module proc_pointers
+  implicit none
+  type :: rectangle
+    real :: width, height
+    procedure(real), pointer, nopass :: get_special_area
+  end type
+end module
+
+program test_objects
+  use proc_pointers
+  implicit none
+  type(rectangle) :: rect
+  write(*,*) rect          ! { dg-error "cannot have procedure pointer components" }
+end program
+
+! { dg-final { cleanup-modules "proc_pointers" } }