]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2009-04-28 Janus Weil <janus@gcc.gnu.org>
authorjanus <janus@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 28 Apr 2009 09:44:36 +0000 (09:44 +0000)
committerjanus <janus@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 28 Apr 2009 09:44:36 +0000 (09:44 +0000)
PR fortran/39930
PR fortran/39931
* expr.c (gfc_check_pointer_assign): Correctly detect if the left hand
side is a pointer.
* parse.c (gfc_fixup_sibling_symbols): Don't check for ambiguity.

2009-04-28  Janus Weil  <janus@gcc.gnu.org>

PR fortran/39930
PR fortran/39931
* gfortran.dg/ambiguous_reference_2.f90: New.
* gfortran.dg/pointer_assign_7.f90: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@146880 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/expr.c
gcc/fortran/parse.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/ambiguous_reference_2.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/pointer_assign_7.f90 [new file with mode: 0644]

index 2ca027108700780e8c8056f395123ed6f08f70e4..6db33255619b28fcd617b2ffe6d726d23999eccf 100644 (file)
@@ -1,3 +1,11 @@
+2009-04-28  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/39930
+       PR fortran/39931
+       * expr.c (gfc_check_pointer_assign): Correctly detect if the left hand
+       side is a pointer.
+       * parse.c (gfc_fixup_sibling_symbols): Don't check for ambiguity.
+
 2009-04-28  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/39879
index c70d4d1e7a1677d76f86ea264d4acad66c61e8b9..e76197e5338cecc149550054f80d7abe1236c961 100644 (file)
@@ -3070,8 +3070,8 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *rvalue)
       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 81e4591b9be4bf7ffee0292a03c8862597937d49..c67e99400f2d371cc8019e82a3d1f9d435ae428b 100644 (file)
@@ -3310,7 +3310,7 @@ gfc_fixup_sibling_symbols (gfc_symbol *sym, gfc_namespace *siblings)
   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 9a8083b87e6df8f1a99b325c92a7699f2327bd4d..541559203912b5978f0ab0c6186673d42d30b280 100644 (file)
@@ -1,3 +1,10 @@
+2009-04-28  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/39930
+       PR fortran/39931
+       * gfortran.dg/ambiguous_reference_2.f90: New.
+       * gfortran.dg/pointer_assign_7.f90: New.
+
 2009-04-28  Nathan Froyd  <froydnj@codesourcery.com>
            Mark Mitchell  <mark@codesourcery.com>
 
diff --git a/gcc/testsuite/gfortran.dg/ambiguous_reference_2.f90 b/gcc/testsuite/gfortran.dg/ambiguous_reference_2.f90
new file mode 100644 (file)
index 0000000..3ffaa14
--- /dev/null
@@ -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" } }
+
diff --git a/gcc/testsuite/gfortran.dg/pointer_assign_7.f90 b/gcc/testsuite/gfortran.dg/pointer_assign_7.f90
new file mode 100644 (file)
index 0000000..5ec32e8
--- /dev/null
@@ -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
+