fortran/
authortobi <tobi@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 11 May 2005 14:52:51 +0000 (14:52 +0000)
committertobi <tobi@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 11 May 2005 14:52:51 +0000 (14:52 +0000)
* resolve.c (resolve_symbol): Copy 'pointer' and 'dimension'
attribute from result symbol to function symbol.
testsuite/
* gfortran.dg/func_result_2.f90: New test.

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

gcc/fortran/ChangeLog
gcc/fortran/resolve.c
gcc/fortran/trans-expr.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/func_result_2.f90 [new file with mode: 0644]

index ee08d1f..c5ae392 100644 (file)
@@ -1,3 +1,8 @@
+2005-05-11  Tobias Schl"uter  <tobias.schlueter@physik.uni-muenchen.de>
+
+       * resolve.c (resolve_symbol): Copy 'pointer' and 'dimension'
+       attribute from result symbol to function symbol.
+
 2005-05-10  Tobias Schl"uter  <tobias.schlueter@physik.uni-muenchen.de>
 
        PR fortran/20178
index 9b097fe..5f7a76a 100644 (file)
@@ -4061,6 +4061,8 @@ resolve_symbol (gfc_symbol * sym)
 
              sym->ts = sym->result->ts;
              sym->as = gfc_copy_array_spec (sym->result->as);
+             sym->attr.dimension = sym->result->attr.dimension;
+             sym->attr.pointer = sym->result->attr.pointer;
            }
        }
     }
index 35c3f12..52a532d 100644 (file)
@@ -1288,7 +1288,7 @@ gfc_conv_function_call (gfc_se * se, gfc_symbol * sym,
 
       if (!se->direct_byref)
        {
-         if (sym->result->attr.dimension)
+         if (sym->attr.dimension)
            {
              if (flag_bounds_check)
                {
index 33a1e02..6e3cae1 100644 (file)
@@ -1,3 +1,7 @@
+2005-05-11  Tobias Schl"uter  <tobias.schlueter@physik.uni-muenchen.de>
+
+       * gfortran.dg/func_result_2.f90: New test.
+
 2005-05-11  Bud Davis  <bdavis@gfortran.org>
 
        * gfortran.dg/dev_null.f90: New test.
diff --git a/gcc/testsuite/gfortran.dg/func_result_2.f90 b/gcc/testsuite/gfortran.dg/func_result_2.f90
new file mode 100644 (file)
index 0000000..2b457d9
--- /dev/null
@@ -0,0 +1,10 @@
+! { dg-do run }
+! Character functions with a result clause were broken
+program testch
+  if (ch().ne."hello     ") call abort()
+contains
+  function ch result(str)
+    character(len = 10)  :: str
+    str ="hello"
+  end function ch
+end program testch