This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

PR 39930/39931


Hi all,

this patch includes the fixes and testcases for PR 39930 and 39931.
The first one was a problem with
Index: gcc/testsuite/gfortran.dg/ambiguous_reference_2.f90
===================================================================
--- gcc/testsuite/gfortran.dg/ambiguous_reference_2.f90	(Revision 0)
+++ gcc/testsuite/gfortran.dg/ambiguous_reference_2.f90	(Revision 0)
@@ -0,0 +1,33 @@
+! { dg-do compile }
+!
+! PR 39930: Bogus error: ambiguous reference
+!
+! Contributed by Janus Weil <janus@gcc.gnu.org>
+
+module a1
+contains
+  subroutine myRoutine
+  end subroutine
+end module 
+
+module a2
+contains
+  subroutine myRoutine
+  end subroutine
+end module 
+
+module b
+contains
+
+  subroutine otherRoutine
+    use a1
+    use a2
+  end subroutine
+
+  subroutine myRoutine
+  end subroutine myRoutine      ! this is not ambiguous !
+
+end module
+
+! { dg-final { cleanup-modules "a1 a2 b" } }
+
Index: gcc/testsuite/gfortran.dg/pointer_assign_7.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pointer_assign_7.f90	(Revision 0)
+++ gcc/testsuite/gfortran.dg/pointer_assign_7.f90	(Revision 0)
@@ -0,0 +1,24 @@
+! { dg-do compile }
+!
+! PR 39931: ICE on invalid Fortran 95 code (bad pointer assignment)
+!
+! Contributed by Thomas Orgis <thomas.orgis@awi.de>
+
+program point_of_no_return
+
+implicit none
+
+type face_t
+  integer :: bla
+end type
+
+integer, pointer :: blu
+type(face_t), pointer :: face
+
+allocate(face)
+allocate(blu)
+
+face%bla => blu  ! { dg-error "Pointer assignment to non-POINTER" }
+
+end program
+
Index: gcc/fortran/expr.c
===================================================================
--- gcc/fortran/expr.c	(Revision 146847)
+++ gcc/fortran/expr.c	(Arbeitskopie)
@@ -3070,8 +3070,8 @@ gfc_check_pointer_assign (gfc_expr *lval
       if (pointer)
 	check_intent_in = 0;
 
-      if (ref->type == REF_COMPONENT && ref->u.c.component->attr.pointer)
-	pointer = 1;
+      if (ref->type == REF_COMPONENT)
+	pointer = ref->u.c.component->attr.pointer;
 
       if (ref->type == REF_ARRAY && ref->next == NULL)
 	{
Index: gcc/fortran/parse.c
===================================================================
--- gcc/fortran/parse.c	(Revision 146847)
+++ gcc/fortran/parse.c	(Arbeitskopie)
@@ -3310,7 +3310,7 @@ gfc_fixup_sibling_symbols (gfc_symbol *s
   sym->attr.referenced = 1;
   for (ns = siblings; ns; ns = ns->sibling)
     {
-      gfc_find_sym_tree (sym->name, ns, 0, &st);
+      st = gfc_find_symtree (ns->sym_root, sym->name);
 
       if (!st || (st->n.sym->attr.dummy && ns == st->n.sym->ns))
 	goto fixup_contained;

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