This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ice in gfc_insert_bbt


Daniel,

Once again thanks for the testcase and for trying the attached patch.

The comments on the attachments tell the story.

The attached rbootstraps and regtests on Cygwin_NT/AMD64.

I have committed to trunk. If all is well, the combined patch will be committed to 4.2 next Sunday.

Apologies to all for the extra problem (sorry Joost, I broke CP2K once again).

Cheers

Paul
2007-02-13  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/30554
	* module.c (read_module): Set pointer_info to referenced if the
	symbol has no namespace.

2007-02-12  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/30554
	* gfortran.dg/used_dummy_types_7.f90: New test.
Index: gcc/fortran/module.c
===================================================================
*** gcc/fortran/module.c	(revision 121863)
--- gcc/fortran/module.c	(working copy)
*************** read_module (void)
*** 3339,3345 ****
    char name[GFC_MAX_SYMBOL_LEN + 1];
    gfc_intrinsic_op i;
    int ambiguous, j, nuse, symbol;
!   pointer_info *info;
    gfc_use_rename *u;
    gfc_symtree *st;
    gfc_symbol *sym;
--- 3339,3345 ----
    char name[GFC_MAX_SYMBOL_LEN + 1];
    gfc_intrinsic_op i;
    int ambiguous, j, nuse, symbol;
!   pointer_info *info, *q;
    gfc_use_rename *u;
    gfc_symtree *st;
    gfc_symbol *sym;
*************** read_module (void)
*** 3390,3395 ****
--- 3390,3405 ----
        info->u.rsym.state = USED;
        info->u.rsym.sym = sym;
  
+       /* Some symbols do not have a namespace (eg. formal arguments),
+ 	 so the automatic "unique symtree" mechanism must be suppressed
+ 	 by marking them as referenced.  */
+       q = get_integer (info->u.rsym.ns);
+       if (q->u.pointer == NULL)
+ 	{
+ 	  info->u.rsym.referenced = 1;
+ 	  continue;
+ 	}
+ 
        /* If possible recycle the symtree that references the symbol.
  	 If a symtree is not found and the module does not import one,
  	 a unique-name symtree is found by read_cleanup.  */
Index: gcc/testsuite/gfortran.dg/used_dummy_types_7.f90
===================================================================
*** gcc/testsuite/gfortran.dg/used_dummy_types_7.f90	(revision 0)
--- gcc/testsuite/gfortran.dg/used_dummy_types_7.f90	(revision 0)
***************
*** 0 ****
--- 1,45 ----
+ ! { dg-do compile }
+ ! This tests a patch for a regression caused by the second part of
+ ! the fix for PR30554.  The linked derived types dummy_atom and
+ ! dummy_atom_list caused a segment fault because they do not have
+ ! a namespace.
+ !
+ ! Contributed by Daniel Franke <franke.daniel@gmail.com>
+ ! 
+ MODULE types
+ TYPE :: dummy_atom_list
+   TYPE(dummy_atom), DIMENSION(:), POINTER :: table => null()
+ END TYPE
+ 
+ TYPE :: dummy_atom
+   TYPE(dummy_atom_private), POINTER :: p => null()
+ END TYPE
+ 
+ TYPE :: dummy_atom_private
+   INTEGER                     :: id
+ END TYPE
+ END MODULE
+ 
+ MODULE atom
+ USE types, ONLY: dummy_atom
+ INTERFACE
+   SUBROUTINE dummy_atom_insert_symmetry_mate(this, other)
+     USE types, ONLY: dummy_atom
+     TYPE(dummy_atom), INTENT(inout) :: this
+     TYPE(dummy_atom), INTENT(in)    :: other
+   END SUBROUTINE
+ END INTERFACE
+ END MODULE
+ 
+ MODULE list
+ INTERFACE
+   SUBROUTINE dummy_atom_list_insert(this, atom)
+     USE types, ONLY: dummy_atom_list
+     USE atom, ONLY: dummy_atom
+ 
+     TYPE(dummy_atom_list), INTENT(inout) :: this
+     TYPE(dummy_atom), INTENT(in)         :: atom
+   END SUBROUTINE
+ END INTERFACE
+ END MODULE
+ ! { dg-final { cleanup-modules "atom types list" } }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]