2012-02-01 Tobias Burnus
authorTobias Burnus <burnus@gcc.gnu.org>
Wed, 1 Feb 2012 19:01:49 +0000 (20:01 +0100)
committerTobias Burnus <burnus@gcc.gnu.org>
Wed, 1 Feb 2012 19:01:49 +0000 (20:01 +0100)
        PR fortran/52059
        * trans-expr.c (gfc_conv_procedure_call): Add array ref
        only to variables.

2012-02-01  Tobias Burnus

        PR fortran/52059
        * gfortran.dg/elemental_function_1.f90: New.

From-SVN: r183807

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

index fbbfccf..2a7cc28 100644 (file)
@@ -1,3 +1,9 @@
+2012-02-01  Tobias Burnus
+
+       PR fortran/52059
+       * trans-expr.c (gfc_conv_procedure_call): Add array ref
+       only to variables.
+
 2012-01-31  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/52024
index 657b4f4..4574c8e 100644 (file)
@@ -3526,7 +3526,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
          gfc_init_se (&parmse, se);
          parm_kind = ELEMENTAL;
 
-         if (se->ss->dimen > 0
+         if (se->ss->dimen > 0 && e->expr_type == EXPR_VARIABLE
              && se->ss->info->data.array.ref == NULL)
            {
              gfc_conv_tmp_array_ref (&parmse);
index 8179fc7..95b1ece 100644 (file)
@@ -1,3 +1,8 @@
+2012-02-01  Tobias Burnus
+
+       PR fortran/52059
+       * gfortran.dg/elemental_function_1.f90: New.
+
 2012-02-01  Georg-Johann Lay  <avr@gjlay.de>
 
        PR rtl-optimization/51374
diff --git a/gcc/testsuite/gfortran.dg/elemental_function_1.f90 b/gcc/testsuite/gfortran.dg/elemental_function_1.f90
new file mode 100644 (file)
index 0000000..8f556f4
--- /dev/null
@@ -0,0 +1,22 @@
+! { dg-do compile }
+!
+! PR fortran/52059
+!
+!
+
+subroutine baz
+  real(kind=8) :: a(99), b
+  interface bar
+    function bar (x, y)
+      integer, intent(in) :: x, y
+      real(kind=8), dimension((y-x)) :: bar
+    end function bar
+  end interface
+  b = 1.0_8
+  a = foo (bar(0,35) / dble(34), b)
+contains
+  elemental real(kind=8) function foo(x, y)
+    real(kind=8), intent(in) :: x, y
+    foo = 1
+  end function foo
+end subroutine baz