re PR fortran/21730 ([4.0 only] Character length incorrect.)
authorDavid Edelsohn <edelsohn@gnu.org>
Sun, 17 Jul 2005 00:48:46 +0000 (00:48 +0000)
committerDavid Edelsohn <dje@gcc.gnu.org>
Sun, 17 Jul 2005 00:48:46 +0000 (20:48 -0400)
        PR fortran/21730
        * decl.c (do_parm): Adjust character initializer to character length
        of symbol before assigning.

From-SVN: r102104

gcc/fortran/ChangeLog
gcc/fortran/decl.c

index 017282ec71a042828e64b6fa2c0ce3358981fc74..49b8dae11cc92ca876ed1eb72da0d0b9008e1390 100644 (file)
@@ -1,3 +1,9 @@
+2005-07-16  David Edelsohn  <edelsohn@gnu.org>
+
+       PR fortran/21730
+       * decl.c (do_parm): Adjust character initializer to character length
+       of symbol before assigning.
+
 2005-07-14  Steve Ellcey  <sje@cup.hp.com>
 
        * trans-types.c (MAX_REAL_KINDS): Increase from 4 to 5.
index 9852cb0c42b317f65240a2313e19d54f5f55bf18..9288ab9d4ef33037bc7b6dc659c3a23664742ab1 100644 (file)
@@ -3101,6 +3101,16 @@ do_parm (void)
       goto cleanup;
     }
 
+  if (sym->ts.type == BT_CHARACTER
+      && sym->ts.cl != NULL
+      && sym->ts.cl->length != NULL
+      && sym->ts.cl->length->expr_type == EXPR_CONSTANT
+      && init->expr_type == EXPR_CONSTANT
+      && init->ts.type == BT_CHARACTER
+      && init->ts.kind == 1)
+    gfc_set_constant_character_len (
+      mpz_get_si (sym->ts.cl->length->value.integer), init);
+
   sym->value = init;
   return MATCH_YES;