]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/fortran/trans-decl.c
Merge from trunk.
[thirdparty/gcc.git] / gcc / fortran / trans-decl.c
index 43f401d83d4e71190b7fb81d2ce406270197bfd7..e201d854dbdb936cd481a6bf54a446fe065ff8d3 100644 (file)
@@ -25,8 +25,12 @@ along with GCC; see the file COPYING3.  If not see
 #include "coretypes.h"
 #include "tm.h"
 #include "tree.h"
+#include "stringpool.h"
+#include "stor-layout.h"
+#include "varasm.h"
+#include "attribs.h"
 #include "tree-dump.h"
-#include "gimple.h"    /* For create_tmp_var_raw.  */
+#include "gimple-expr.h"       /* For create_tmp_var_raw.  */
 #include "ggc.h"
 #include "diagnostic-core.h"   /* For internal_error.  */
 #include "toplev.h"    /* For announce_function.  */
@@ -405,7 +409,7 @@ gfc_can_put_var_on_stack (tree size)
   if (gfc_option.flag_max_stack_var_size < 0)
     return 1;
 
-  if (TREE_INT_CST_HIGH (size) != 0)
+  if (!cst_fits_uhwi_p (size))
     return 0;
 
   low = TREE_INT_CST_LOW (size);
@@ -4745,7 +4749,8 @@ generate_local_decl (gfc_symbol * sym)
                gfc_warning ("Dummy argument '%s' at %L was declared "
                             "INTENT(OUT) but was not set",  sym->name,
                             &sym->declared_at);
-             else if (!gfc_has_default_initializer (sym->ts.u.derived))
+             else if (!gfc_has_default_initializer (sym->ts.u.derived)
+                      && !sym->ts.u.derived->attr.zero_comp)
                gfc_warning ("Derived-type dummy argument '%s' at %L was "
                             "declared INTENT(OUT) but was not set and "
                             "does not have a default initializer",
@@ -5643,14 +5648,16 @@ gfc_generate_function_code (gfc_namespace * ns)
     }
   current_function_decl = old_context;
 
-  if (decl_function_context (fndecl) && gfc_option.coarray != GFC_FCOARRAY_LIB
-      && has_coarray_vars)
-    /* Register this function with cgraph just far enough to get it
-       added to our parent's nested function list.
-       If there are static coarrays in this function, the nested _caf_init
-       function has already called cgraph_create_node, which also created
-       the cgraph node for this function.  */
-    (void) cgraph_create_node (fndecl);
+  if (decl_function_context (fndecl))
+    {
+      /* Register this function with cgraph just far enough to get it
+        added to our parent's nested function list.
+        If there are static coarrays in this function, the nested _caf_init
+        function has already called cgraph_create_node, which also created
+        the cgraph node for this function.  */
+      if (!has_coarray_vars || gfc_option.coarray != GFC_FCOARRAY_LIB)
+       (void) cgraph_create_node (fndecl);
+    }
   else
     cgraph_finalize_function (fndecl, true);