This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix for PR fortran/21375
Steve Kargl wrote:
> OK for mainline? Ok for 4.0.1 with Mark's approval?
This is ok with one minor nit:
> *** 1899,1905 ****
>
> gfor_fndecl_deallocate =
> gfc_build_library_function_decl (get_identifier (PREFIX("deallocate")),
> ! void_type_node, 1, ppvoid_type_node);
>
> gfor_fndecl_stop_numeric =
> gfc_build_library_function_decl (get_identifier (PREFIX("stop_numeric")),
> --- 1899,1906 ----
>
> gfor_fndecl_deallocate =
> gfc_build_library_function_decl (get_identifier (PREFIX("deallocate")),
> ! void_type_node, 2, ppvoid_type_node,
> ! gfc_int4_type_node);
^^^^^^^^^^^^^^^^^^
> + /* Set up the optional STAT= */
> + if (code->expr)
> + {
> + /* Variable used with the library call. */
> + tree gfc_int4_type_node = gfc_get_int_type (4);
> + stat = gfc_create_var (gfc_int4_type_node, "stat");
> + pstat = gfc_build_addr_expr (NULL, stat);
> +
> + /* Running total of possible deallocation failures. */
> + astat = gfc_create_var (gfc_int4_type_node, "astat");
> + apstat = gfc_build_addr_expr (NULL, astat);
> +
> + /* Initialize astat to 0. */
> + gfc_add_modify_expr (&block, astat, build_int_cst (TREE_TYPE (astat), 0));
> + }
> + else
> + {
> + pstat = apstat = integer_zero_node;
^^^^^^^^^^^^^^^^^
Those should be pointers to int4. See the top of
gfc_build_io_library_fndecls() for how to create that type. We should
probably add a global variable gfc_pint4_type_node for this along the other
type nodes, and move that code out of gfc_build_io_library_fndecls, but I'm
fine if you put it in a local variable.
- Tobi