https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70937

--- Comment #8 from rguenther at suse dot de <rguenther at suse dot de> ---
On May 4, 2016 6:20:14 PM GMT+02:00, "dominiq at lps dot ens.fr"
<gcc-bugzi...@gcc.gnu.org> wrote:
>https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70937
>
>--- Comment #7 from Dominique d'Humieres <dominiq at lps dot ens.fr>
>---
>The ICEs are gone with the patch
>
>--- ../_clean/gcc/fortran/trans-decl.c  2016-03-28 13:03:29.000000000
>+0200
>+++ ../p_work/gcc/fortran/trans-decl.c  2016-05-04 16:13:21.000000000
>+0200
>@@ -6013,6 +6013,29 @@ finish_oacc_declare (gfc_namespace *ns, 
> }
>
>
>+static stmtblock_t *place_decl_expr_init;
>+static void
>+place_decl_expr (gfc_symbol *sym)
>+{   
>+  if (sym->backend_decl)
>+    {
>+      tree type = sym->backend_decl;
>+      if (DECL_P (sym->backend_decl))
>+        type = TREE_TYPE (type);
>+      else
>+        gcc_assert (TYPE_P (type));
>+      while (POINTER_TYPE_P (type))
>+        type = TREE_TYPE (type);
>+      if (variably_modified_type_p (type, NULL))
>+        {   
>+          if (TYPE_NAME (type))    
>+            gfc_add_expr_to_block (place_decl_expr_init,
>+                                   build1 (DECL_EXPR, type, TYPE_NAME
>(type)));
>+        }
>+    }
>+}
>+
>+
> /* Generate code for a function.  */
>
> void
>@@ -6088,6 +6111,9 @@ gfc_generate_function_code (gfc_namespac
>   has_coarray_vars = false;
>   generate_local_vars (ns);
>
>+  place_decl_expr_init = &init;
>+  gfc_traverse_ns (ns, place_decl_expr);
>+
>   if (flag_coarray == GFC_FCOARRAY_LIB && has_coarray_vars)
>     generate_coarray_init (ns);
>
>
>However, I see several execution failures:
>
>FAIL: gfortran.dg/array_constructor_type_7.f03   -Oxx  execution test
>where xx
>depends on -m32/-m64
>FAIL: gfortran.dg/auto_char_dummy_array_1.f90   -O*  execution test
>FAIL: gfortran.dg/namelist_70.f90   -O*  execution test
>FAIL: gfortran.dg/string_ctor_1.f90   -Oxx  execution test  where xx
>depends on
>-m32/-m64
>
>FAIL: libgomp.fortran/task2.f90   -O  execution test
>FAIL: libgomp.fortran/vla*.f90   -O*  execution test

As said FORTRAN people need to help here.  The DECL_EXPRs need to be placed
where the variables go into scope.

I'll see how far as I can get here on Friday but somebody more knowledgeable of
the frontend might be faster.

Reply via email to