2005-10-07 Erik Edelmann <erik.edelmann@iki.fi>
authortobi <tobi@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 6 Oct 2005 15:44:01 +0000 (15:44 +0000)
committertobi <tobi@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 6 Oct 2005 15:44:01 +0000 (15:44 +0000)
fortran/
        PR 18568
* resolve.c (find_array_spec): Search through the list of
components in the symbol of the type instead of the symbol of the
variable.
testsuite/
PR 18568
* gfortran.dg/der_pointer_3.f90: New test.

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

gcc/fortran/ChangeLog
gcc/fortran/resolve.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/der_pointer_3.f90 [new file with mode: 0644]

index 5663b31..f12abc2 100644 (file)
@@ -1,3 +1,10 @@
+2005-10-07  Erik Edelmann  <erik.edelmann@iki.fi>
+
+        PR 18568
+       * resolve.c (find_array_spec): Search through the list of
+       components in the symbol of the type instead of the symbol of the
+       variable.
+
 2005-10-05  Richard Guenther  <rguenther@suse.de>
 
        PR fortran/24176
index 192a18c..f057340 100644 (file)
@@ -1912,7 +1912,6 @@ find_array_spec (gfc_expr * e)
   gfc_ref *ref;
 
   as = e->symtree->n.sym->as;
-  c = e->symtree->n.sym->components;
 
   for (ref = e->ref; ref; ref = ref->next)
     switch (ref->type)
@@ -1926,7 +1925,7 @@ find_array_spec (gfc_expr * e)
        break;
 
       case REF_COMPONENT:
-       for (; c; c = c->next)
+       for (c = e->symtree->n.sym->ts.derived->components; c; c = c->next)
          if (c == ref->u.c.component)
            break;
 
@@ -1940,7 +1939,6 @@ find_array_spec (gfc_expr * e)
            as = c->as;
          }
 
-       c = c->ts.derived->components;
        break;
 
       case REF_SUBSTRING:
index be22aa9..71b4ecb 100644 (file)
@@ -1,3 +1,8 @@
+2005-10-07  Erik Edelmann  <erik.edelmann@iki.fi>
+
+       PR 18568
+       * gfortran.dg/der_pointer_3.f90: New test.
+
 2005-10-05  Devang Patel  <dpatel@apple.com>
 
        PR Debug/23205
diff --git a/gcc/testsuite/gfortran.dg/der_pointer_3.f90 b/gcc/testsuite/gfortran.dg/der_pointer_3.f90
new file mode 100644 (file)
index 0000000..ed56ffc
--- /dev/null
@@ -0,0 +1,18 @@
+! { dg-do compile }
+! PR 18568
+! Find pointer-to-array components
+module ints
+   type :: bar
+      integer, pointer :: th(:)
+   end type bar
+contains
+   function foo(b)
+      type(bar), intent(in) :: b
+      integer :: foo(size(b%th))
+      foo = 0
+   end function foo
+end module ints
+
+program size_test
+  use ints
+end program size_test