OSDN Git Service

2008-08-28 Janus Weil <janus@gcc.gnu.org>
authorjanus <janus@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 28 Aug 2008 15:10:50 +0000 (15:10 +0000)
committerjanus <janus@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 28 Aug 2008 15:10:50 +0000 (15:10 +0000)
PR fortran/37253
* module.c (ab_attribute,attr_bits,mio_symbol_attribute): Take care of
saving attr.procedure and attr.proc_ptr to the module file.

2008-08-28  Janus Weil  <janus@gcc.gnu.org>

PR fortran/37253
* gfortran.dg/proc_ptr_10.f90: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@139713 138bc75d-0d04-0410-961f-82ee72b054a4

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

index b606361..c626a65 100644 (file)
@@ -1,3 +1,9 @@
+2008-08-28  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/37253
+       * module.c (ab_attribute,attr_bits,mio_symbol_attribute): Take care of
+       saving attr.procedure and attr.proc_ptr to the module file.
+
 2008-08-25  Daniel Kraft  <d@domob.eu>
 
        * gfortran.h (gfc_find_component): Add new arguments.
index d5cf382..26dc58b 100644 (file)
@@ -1649,7 +1649,7 @@ typedef enum
   AB_CRAY_POINTER, AB_CRAY_POINTEE, AB_THREADPRIVATE, AB_ALLOC_COMP,
   AB_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_EXTENSION
+  AB_EXTENSION, AB_PROCEDURE, AB_PROC_POINTER
 }
 ab_attribute;
 
@@ -1690,6 +1690,8 @@ static const mstring attr_bits[] =
     minit ("PROTECTED", AB_PROTECTED),
     minit ("ABSTRACT", AB_ABSTRACT),
     minit ("EXTENSION", AB_EXTENSION),
+    minit ("PROCEDURE", AB_PROCEDURE),
+    minit ("PROC_POINTER", AB_PROC_POINTER),
     minit (NULL, -1)
 };
 
@@ -1805,6 +1807,10 @@ mio_symbol_attribute (symbol_attribute *attr)
        MIO_NAME (ab_attribute) (AB_ZERO_COMP, attr_bits);
       if (attr->extension)
        MIO_NAME (ab_attribute) (AB_EXTENSION, attr_bits);
+      if (attr->procedure)
+       MIO_NAME (ab_attribute) (AB_PROCEDURE, attr_bits);
+      if (attr->proc_pointer)
+       MIO_NAME (ab_attribute) (AB_PROC_POINTER, attr_bits);
 
       mio_rparen ();
 
@@ -1926,6 +1932,12 @@ mio_symbol_attribute (symbol_attribute *attr)
            case AB_EXTENSION:
              attr->extension = 1;
              break;
+           case AB_PROCEDURE:
+             attr->procedure = 1;
+             break;
+           case AB_PROC_POINTER:
+             attr->proc_pointer = 1;
+             break;
            }
        }
     }
index 3eed73a..96b49b6 100644 (file)
@@ -1,3 +1,8 @@
+2008-08-28  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/37253
+       * gfortran.dg/proc_ptr_10.f90: New.
+
 2008-08-28  Dodji Seketeli  <dodji@redhat.com>
 
        PR c++/36741
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_10.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_10.f90
new file mode 100644 (file)
index 0000000..0ceedaa
--- /dev/null
@@ -0,0 +1,30 @@
+! { dg-do run }
+!
+! PR fortran/37253
+!
+! Contributed by Dominique d'Humieres <dominiq@lps.ens.fr>
+
+module myMod
+
+  CONTAINS
+
+  real function proc3( arg1 )
+     integer :: arg1
+     proc3 = arg1+7
+  end function proc3
+
+  subroutine proc4( arg1 )
+     procedure(real), pointer :: arg1
+     if (arg1(0)/=7) call abort()
+  end subroutine proc4
+
+end module myMod
+
+program myProg
+  use myMod
+  PROCEDURE (real), POINTER :: p => NULL()
+  p => proc3
+  call proc4( p )
+end program myProg
+! { dg-final { cleanup-modules "myMod" } }