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
This commit is contained in:
Janus Weil 2008-08-28 17:10:50 +02:00
parent 5bdc1946f0
commit b7fdeec95f
4 changed files with 54 additions and 1 deletions

View 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.

View 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;
}
}
}

View 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

View File

@ -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" } }