From: janus Date: Tue, 28 Apr 2009 09:44:36 +0000 (+0000) Subject: 2009-04-28 Janus Weil X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=81f278c338337f1bec55dc5aeacc2a601d07fdd9;p=thirdparty%2Fgcc.git 2009-04-28 Janus Weil 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 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 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 2ca027108700..6db33255619b 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,11 @@ +2009-04-28 Janus Weil + + 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 PR fortran/39879 diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index c70d4d1e7a16..e76197e5338c 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -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) { diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c index 81e4591b9be4..c67e99400f2d 100644 --- a/gcc/fortran/parse.c +++ b/gcc/fortran/parse.c @@ -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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9a8083b87e6d..541559203912 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2009-04-28 Janus Weil + + 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 Mark Mitchell diff --git a/gcc/testsuite/gfortran.dg/ambiguous_reference_2.f90 b/gcc/testsuite/gfortran.dg/ambiguous_reference_2.f90 new file mode 100644 index 000000000000..3ffaa14591db --- /dev/null +++ b/gcc/testsuite/gfortran.dg/ambiguous_reference_2.f90 @@ -0,0 +1,33 @@ +! { dg-do compile } +! +! PR 39930: Bogus error: ambiguous reference +! +! Contributed by Janus Weil + +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 index 000000000000..5ec32e8d66eb --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pointer_assign_7.f90 @@ -0,0 +1,24 @@ +! { dg-do compile } +! +! PR 39931: ICE on invalid Fortran 95 code (bad pointer assignment) +! +! Contributed by Thomas Orgis + +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 +