Commit b7fdeec9 by Janus Weil

re PR fortran/37253 (Segmentation fault with procedure pointer)

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-28  Janus Weil  <janus@gcc.gnu.org>

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

From-SVN: r139713
parent 5bdc1946
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> 2008-08-25 Daniel Kraft <d@domob.eu>
* gfortran.h (gfc_find_component): Add new arguments. * gfortran.h (gfc_find_component): Add new arguments.
......
...@@ -1649,7 +1649,7 @@ typedef enum ...@@ -1649,7 +1649,7 @@ typedef enum
AB_CRAY_POINTER, AB_CRAY_POINTEE, AB_THREADPRIVATE, AB_ALLOC_COMP, AB_CRAY_POINTER, AB_CRAY_POINTEE, AB_THREADPRIVATE, AB_ALLOC_COMP,
AB_POINTER_COMP, AB_PRIVATE_COMP, AB_VALUE, AB_VOLATILE, AB_PROTECTED, 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_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; ab_attribute;
...@@ -1690,6 +1690,8 @@ static const mstring attr_bits[] = ...@@ -1690,6 +1690,8 @@ static const mstring attr_bits[] =
minit ("PROTECTED", AB_PROTECTED), minit ("PROTECTED", AB_PROTECTED),
minit ("ABSTRACT", AB_ABSTRACT), minit ("ABSTRACT", AB_ABSTRACT),
minit ("EXTENSION", AB_EXTENSION), minit ("EXTENSION", AB_EXTENSION),
minit ("PROCEDURE", AB_PROCEDURE),
minit ("PROC_POINTER", AB_PROC_POINTER),
minit (NULL, -1) minit (NULL, -1)
}; };
...@@ -1805,6 +1807,10 @@ mio_symbol_attribute (symbol_attribute *attr) ...@@ -1805,6 +1807,10 @@ mio_symbol_attribute (symbol_attribute *attr)
MIO_NAME (ab_attribute) (AB_ZERO_COMP, attr_bits); MIO_NAME (ab_attribute) (AB_ZERO_COMP, attr_bits);
if (attr->extension) if (attr->extension)
MIO_NAME (ab_attribute) (AB_EXTENSION, attr_bits); 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 (); mio_rparen ();
...@@ -1926,6 +1932,12 @@ mio_symbol_attribute (symbol_attribute *attr) ...@@ -1926,6 +1932,12 @@ mio_symbol_attribute (symbol_attribute *attr)
case AB_EXTENSION: case AB_EXTENSION:
attr->extension = 1; attr->extension = 1;
break; break;
case AB_PROCEDURE:
attr->procedure = 1;
break;
case AB_PROC_POINTER:
attr->proc_pointer = 1;
break;
} }
} }
} }
......
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> 2008-08-28 Dodji Seketeli <dodji@redhat.com>
PR c++/36741 PR c++/36741
......
! { 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" } }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment