OSDN Git Service

PR fortran/33881
authorfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 3 Nov 2007 22:12:03 +0000 (22:12 +0000)
committerfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 3 Nov 2007 22:12:03 +0000 (22:12 +0000)
* trans-array.c (gfc_conv_array_parameter): Evaluate
se->string_length instead of the expr->ts.cl->backend_decl.

* gfortran.dg/assumed_charlen_arg_1.f90: New test.

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

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

index 4322dd4..42c726c 100644 (file)
@@ -1,5 +1,11 @@
 2007-11-03  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
 
+       PR fortran/33881
+       * trans-array.c (gfc_conv_array_parameter): Evaluate
+       se->string_length instead of the expr->ts.cl->backend_decl.
+
+2007-11-03  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
+
        * gfortran.h: Shorten comment.
        * trans-types.c (gfc_get_function_type): Allow argument to have
        flavor FL_PROGRAM.
index 1c47b24..87ef815 100644 (file)
@@ -4972,8 +4972,8 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, gfc_ss * ss, int g77)
   if (expr->expr_type == EXPR_ARRAY && expr->ts.type == BT_CHARACTER)
     {
       get_array_ctor_strlen (&se->pre, expr->value.constructor, &tmp);
-      expr->ts.cl->backend_decl = gfc_evaluate_now (tmp, &se->pre);
-      se->string_length = expr->ts.cl->backend_decl;
+      expr->ts.cl->backend_decl = tmp;
+      se->string_length = gfc_evaluate_now (tmp, &se->pre);
     }
 
   /* Is this the result of the enclosing procedure?  */
index 4634c63..89cbd13 100644 (file)
@@ -1,3 +1,8 @@
+2007-11-03  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
+
+       PR fortran/33881
+       * gfortran.dg/assumed_charlen_arg_1.f90: New test.
+
 2007-11-03  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
 
        PR c/29062
diff --git a/gcc/testsuite/gfortran.dg/assumed_charlen_arg_1.f90 b/gcc/testsuite/gfortran.dg/assumed_charlen_arg_1.f90
new file mode 100644 (file)
index 0000000..4fc0efd
--- /dev/null
@@ -0,0 +1,18 @@
+! { dg-do run }
+! From PR 33881
+  call create_watch_ss(" ")
+contains
+  subroutine create_watch_actual(name)
+    character(len=1) :: name(1)
+  end subroutine create_watch_actual
+
+  subroutine create_watch_ss(name,clock)
+    character(len=*) :: name
+    integer, optional :: clock
+    if (present(clock)) then
+      call create_watch_actual((/name/))
+    else
+      call create_watch_actual((/name/))
+    end if
+  end subroutine create_watch_ss
+end