re PR fortran/60191 (test case gfortran.dg/dynamic_dispatch_1/3.f03 fail on ARMv7)
authorBernd Edlinger <edlinger@gcc.gnu.org>
Fri, 4 Apr 2014 13:54:16 +0000 (13:54 +0000)
committerBernd Edlinger <edlinger@gcc.gnu.org>
Fri, 4 Apr 2014 13:54:16 +0000 (13:54 +0000)
2014-04-04  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        PR fortran/60191
        * fortran/trans-types.c (gfc_get_function_type): In case of recursion
        build a variadic function type with empty argument list instead of a
        stdarg-like function type with incomplete argument list.

From-SVN: r209091

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

index 33c1669d09dc8278636035c9b1e7d9935b2db833..15419fe7fbb3cb1665811db7f71501965f01d86f 100644 (file)
@@ -1,6 +1,13 @@
+2014-04-04  Bernd Edlinger  <bernd.edlinger@hotmail.de>
+
+       PR fortran/60191
+       * fortran/trans-types.c (gfc_get_function_type): In case of recursion
+       build a variadic function type with empty argument list instead of a
+       stdarg-like function type with incomplete argument list.
+
 2014-04-04  Jeff Law  <law@redhat.com>
 
-        PR target/60657
+       PR target/60657
        * config/arm/predicates.md (const_int_I_operand): New predicate.
        (const_int_M_operand): Similarly.
        * config/arm/arm.md (insv_zero): Use const_int_M_operand instead of
index be268cfbdec9521a593b71a7d340ca0d1b4aa26a..59637f2d3cb730115ef1a99dc4b0091153cc47db 100644 (file)
@@ -2714,11 +2714,11 @@ tree
 gfc_get_function_type (gfc_symbol * sym)
 {
   tree type;
-  vec<tree, va_gc> *typelist;
+  vec<tree, va_gc> *typelist = NULL;
   gfc_formal_arglist *f;
   gfc_symbol *arg;
-  int alternate_return;
-  bool is_varargs = true, recursive_type = false;
+  int alternate_return = 0;
+  bool is_varargs = true;
 
   /* Make sure this symbol is a function, a subroutine or the main
      program.  */
@@ -2730,15 +2730,12 @@ gfc_get_function_type (gfc_symbol * sym)
   if (sym->backend_decl == NULL)
     sym->backend_decl = error_mark_node;
   else if (sym->backend_decl == error_mark_node)
-    recursive_type = true;
+    goto arg_type_list_done;
   else if (sym->attr.proc_pointer)
     return TREE_TYPE (TREE_TYPE (sym->backend_decl));
   else
     return TREE_TYPE (sym->backend_decl);
 
-  alternate_return = 0;
-  typelist = NULL;
-
   if (sym->attr.entry_master)
     /* Additional parameter for selecting an entry point.  */
     vec_safe_push (typelist, gfc_array_index_type);
@@ -2786,13 +2783,6 @@ gfc_get_function_type (gfc_symbol * sym)
 
          if (arg->attr.flavor == FL_PROCEDURE)
            {
-             /* We don't know in the general case which argument causes
-                recursion.  But we know that it is a procedure.  So we give up
-                creating the procedure argument type list at the first
-                procedure argument.  */
-             if (recursive_type)
-               goto arg_type_list_done;
-
              type = gfc_get_function_type (arg);
              type = build_pointer_type (type);
            }
@@ -2846,11 +2836,11 @@ gfc_get_function_type (gfc_symbol * sym)
       || sym->attr.if_source != IFSRC_UNKNOWN)
     is_varargs = false;
 
-arg_type_list_done:
-
-  if (!recursive_type && sym->backend_decl == error_mark_node)
+  if (sym->backend_decl == error_mark_node)
     sym->backend_decl = NULL_TREE;
 
+arg_type_list_done:
+
   if (alternate_return)
     type = integer_type_node;
   else if (!sym->attr.function || gfc_return_by_reference (sym))
@@ -2888,7 +2878,7 @@ arg_type_list_done:
   else
     type = gfc_sym_type (sym);
 
-  if (is_varargs || recursive_type)
+  if (is_varargs)
     type = build_varargs_function_type_vec (type, typelist);
   else
     type = build_function_type_vec (type, typelist);