re PR testsuite/87487 (New test case gfortran.dg/deferred_character_24.f90 in r264721...
authorPaul Thomas <pault@gcc.gnu.org>
Fri, 5 Oct 2018 07:01:57 +0000 (07:01 +0000)
committerPaul Thomas <pault@gcc.gnu.org>
Fri, 5 Oct 2018 07:01:57 +0000 (07:01 +0000)
2018-10-05  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/87487
* trans-decl.c (gfc_get_symbol_decl): Make sure that deferred
character length pointer initializer has the right type to fix
problem with deferred_character_24.f90 on big endian.

From-SVN: r264862

gcc/fortran/ChangeLog
gcc/fortran/trans-decl.c

index 521247c2dcc78a13a899dbbe08ffb249c7f25408..7eece23364044a3ac5e7351168f3030887f0e564 100644 (file)
@@ -1,6 +1,13 @@
+2018-10-05  Paul Thomas  <pault@gcc.gnu.org>
+
+       PR fortran/87487
+       * trans-decl.c (gfc_get_symbol_decl): Make sure that deferred
+       character length pointer initializer has the right type to fix
+       problem with deferred_character_24.f90 on big endian.
+
 2018-10-03  Jeff Law  <law@redhat.comg>
 
-        * trans-types.c (get_typenode_from_name): Moved into gcc/tree.c.
+       * trans-types.c (get_typenode_from_name): Moved into gcc/tree.c.
 
 2018-10-01  Paul Thomas  <pault@gcc.gnu.org>
 
index f7568d5a6c42dec031c6bf2da51f335720c32e76..b0c12e5fc38107559a734d1dc87fd675a2466630 100644 (file)
@@ -1758,6 +1758,7 @@ gfc_get_symbol_decl (gfc_symbol * sym)
       && TREE_CODE (length) != INTEGER_CST
       && TREE_CODE (sym->ts.u.cl->backend_decl) != INDIRECT_REF)
     {
+      length = fold_convert (gfc_charlen_type_node, length);
       gfc_finish_var_decl (length, sym);
       if (!sym->attr.associate_var
          && TREE_CODE (length) == VAR_DECL
@@ -1767,6 +1768,8 @@ gfc_get_symbol_decl (gfc_symbol * sym)
          DECL_INITIAL (length) = gfc_conv_initializer (len, &len->ts,
                                                        TREE_TYPE (length),
                                                        false, false, false);
+         DECL_INITIAL (length) = fold_convert (gfc_charlen_type_node,
+                                               DECL_INITIAL (length));
        }
       else
        gcc_assert (!sym->value);