re PR fortran/43450 (-fwhole-file: ICE in gfc_create_module_variable, at fortran/trans-decl.c:3386)

2010-03-20  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/43450
	* trans-decl.c (gfc_create_module_variable): With -fwhole-file
	do not assert the context of derived types.

2010-03-20  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/43450
	* gfortran.dg/whole_file_15.f90 : New test.

From-SVN: r157595
This commit is contained in:
Paul Thomas 2010-03-20 16:01:17 +00:00
parent 21b04412b0
commit b8849663cf
4 changed files with 53 additions and 5 deletions

View file

@ -1,3 +1,9 @@
2010-03-20 Paul Thomas <pault@gcc.gnu.org>
PR fortran/43450
* trans-decl.c (gfc_create_module_variable): With -fwhole-file
do not assert the context of derived types.
2010-03-20 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/43409

View file

@ -3382,11 +3382,16 @@ gfc_create_module_variable (gfc_symbol * sym)
{
decl = sym->backend_decl;
gcc_assert (sym->ns->proc_name->attr.flavor == FL_MODULE);
gcc_assert (TYPE_CONTEXT (decl) == NULL_TREE
|| TYPE_CONTEXT (decl) == sym->ns->proc_name->backend_decl);
gcc_assert (DECL_CONTEXT (TYPE_STUB_DECL (decl)) == NULL_TREE
|| DECL_CONTEXT (TYPE_STUB_DECL (decl))
== sym->ns->proc_name->backend_decl);
/* -fwhole-file mixes up the contexts so these asserts are unnecessary. */
if (!(gfc_option.flag_whole_file && sym->attr.use_assoc))
{
gcc_assert (TYPE_CONTEXT (decl) == NULL_TREE
|| TYPE_CONTEXT (decl) == sym->ns->proc_name->backend_decl);
gcc_assert (DECL_CONTEXT (TYPE_STUB_DECL (decl)) == NULL_TREE
|| DECL_CONTEXT (TYPE_STUB_DECL (decl))
== sym->ns->proc_name->backend_decl);
}
TYPE_CONTEXT (decl) = sym->ns->proc_name->backend_decl;
DECL_CONTEXT (TYPE_STUB_DECL (decl)) = sym->ns->proc_name->backend_decl;
gfc_module_add_decl (cur_module, TYPE_STUB_DECL (decl));

View file

@ -1,3 +1,8 @@
2010-03-20 Paul Thomas <pault@gcc.gnu.org>
PR fortran/43450
* gfortran.dg/whole_file_15.f90 : New test.
2010-03-20 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/43409

View file

@ -0,0 +1,32 @@
! { dg-do compile }
! { dg-options "-fwhole-file" }
! Test the fix for PR43450 in which the use of 'replica_env_type'
! caused an ICE in ep_types
!
! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
!
MODULE replica_types
TYPE replica_env_type
END TYPE replica_env_type
CONTAINS
SUBROUTINE rep_env_create(rep_env, para_env, input, nrep, prep,&
sync_v,keep_wf_history,row_force)
END SUBROUTINE rep_env_create
SUBROUTINE rep_envs_add_rep_env(rep_env)
TYPE(replica_env_type), POINTER :: rep_env
END SUBROUTINE rep_envs_add_rep_env
END MODULE replica_types
MODULE ep_types
USE replica_types
TYPE ep_env_type
TYPE(replica_env_type), POINTER :: mol_envs
END TYPE ep_env_type
TYPE ep_env_p_type
TYPE(ep_env_type), POINTER :: ep_env
END TYPE ep_env_p_type
TYPE(ep_env_p_type), DIMENSION(:), POINTER :: ep_envs
CONTAINS
SUBROUTINE ep_force_release()
END SUBROUTINE ep_force_release
END MODULE ep_types
! { dg-final { cleanup-modules "replica_types ep_types" } }