This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Committed] Fix for ppc64 libgfortran bootstrap failures
- From: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- To: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Mon, 9 Jul 2007 12:48:36 -0700
- Subject: [Committed] Fix for ppc64 libgfortran bootstrap failures
I've committed the attached patch as a fix for the recent
bootstrap failures on powerpc64 linux due to libgfortran.
Both Revital1 Eres and Diego Novillo tested a version of
the patch that used '#if 0 ... #endif' to remove the
offending code. I've also verified with Chris, the author
of the ISO C binding path, that the offending code could
be removed. It is actually reminants from his implementation
of the Fortran 2003 VALUE attribute, which was supplanted
by a patch from Paul Thomas.
Although this patch fixes the bootstrap failure, I believe,
and Diego as re-inforced my belief, that the Fortran front-end
may be overwriting memory. It looks like we (gfortran gang)
are due for some valgrind sessions.
I bootstrapped and regression tested this on i386-*-freebsd
and amd64-*-freebsd. Revital1 and Diego were able to at
least bootstrap on ppc64 linux.
2007-07-09 Steven G. Kargl <kargl@gcc.gnu.org>
* trans-decl.c (set_tree_decl_type_code): Remove function.
(generate_local_decl): Remove reference to set_tree_decl_type_code.
--
Steve
Index: trans-decl.c
===================================================================
--- trans-decl.c (revision 126488)
+++ trans-decl.c (working copy)
@@ -2840,41 +2840,6 @@ gfc_generate_contained_functions (gfc_na
}
-/* Set up the tree type for the given symbol to allow the dummy
- variable (parameter) to be passed by-value. To do this, the main
- idea is to simply remove the extra layer added by Fortran
- automatically (the POINTER_TYPE node). This pointer type node
- would normally just contain the real type underneath, but we remove
- it here and later we change the way the argument is converted for a
- function call (trans-expr.c:gfc_conv_function_call). This is the
- approach the C compiler takes (or it appears to be this way). When
- the middle-end is given the typed node rather than the POINTER_TYPE
- node, it knows to pass the value. */
-
-static void
-set_tree_decl_type_code (gfc_symbol *sym)
-{
- /* This should not happen. during the gfc_sym_type function,
- when the backend_decl is being built for a dummy arg, if the arg
- is pass-by-value then no reference type is wrapped around the
- true type (e.g., REAL_TYPE). */
- if (TREE_CODE (TREE_TYPE (sym->backend_decl)) == POINTER_TYPE ||
- TREE_CODE (TREE_TYPE (sym->backend_decl)) == REFERENCE_TYPE)
- TREE_TYPE (sym->backend_decl) = gfc_typenode_for_spec (&sym->ts);
- DECL_BY_REFERENCE (sym->backend_decl) = 0;
-
- /* the tree can't be addressable if it's pass-by-value..? x*/
-/* TREE_TYPE(sym->backend_decl)->common.addressable_flag = 0; */
-
- DECL_ARG_TYPE (sym->backend_decl) = TREE_TYPE (sym->backend_decl);
-
- DECL_MODE (sym->backend_decl) =
- TYPE_MODE (TREE_TYPE (sym->backend_decl));
-
- return;
-}
-
-
/* Drill down through expressions for the array specification bounds and
character length calling generate_local_decl for all those variables
that have not already been declared. */
@@ -3042,15 +3007,6 @@ generate_local_decl (gfc_symbol * sym)
&& !sym->attr.use_assoc)
gfc_warning ("unused parameter '%s' declared at %L", sym->name,
&sym->declared_at);
- }
-
- if (sym->attr.dummy == 1)
- {
- /* The sym->backend_decl can be NULL if this is one of the
- intrinsic types, such as the symbol of type c_ptr for the
- c_f_pointer function, so don't set up the tree code for it. */
- if (sym->attr.value == 1 && sym->backend_decl != NULL)
- set_tree_decl_type_code (sym);
}
/* Make sure we convert the types of the derived types from iso_c_binding