This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[lto]: Fix bootstrap on 32bit host
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: dnovillo at google dot com
- Date: Wed, 13 May 2009 07:26:31 -0700
- Subject: [lto]: Fix bootstrap on 32bit host
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
Hi,
LTO failed to bootstrap on 32bit host due to mismatched HOST_WIDE_INT
and HOST_WIDEST_INT:
../../src-lto/gcc/lto-function-out.c: In function 'output_function':
../../src-lto/gcc/lto-function-out.c:2034: error: passing argument 1 of
'lto_set_flag' from incompatible pointer type
../../src-lto/gcc/lto-section-out.h:168: note: expected 'long long
unsigned int *' but argument is of type 'long unsigned int *'
I am checking in this patch as an obvious fix.
H.J.
---
Index: lto-function-out.c
===================================================================
--- lto-function-out.c (revision 147465)
+++ lto-function-out.c (working copy)
@@ -2004,7 +2004,7 @@ static int function_num;
static void
output_function (struct cgraph_node *node)
{
- unsigned HOST_WIDE_INT flags;
+ unsigned HOST_WIDEST_INT flags;
tree function = node->decl;
struct function *fn = DECL_STRUCT_FUNCTION (function);
basic_block bb;
@@ -2047,7 +2047,7 @@ output_function (struct cgraph_node *nod
lto_set_flags (&flags, fn->va_list_fpr_size, 8);
lto_set_flags (&flags, fn->va_list_gpr_size, 8);
- lto_output_uleb128_stream (ob->main_stream, flags);
+ lto_output_widest_uint_uleb128_stream (ob->main_stream, flags);
/* Output the static chain and non-local goto save area. */
if (fn->static_chain_decl)
Index: lto-function-in.c
===================================================================
--- lto-function-in.c (revision 147465)
+++ lto-function-in.c (working copy)
@@ -1888,7 +1888,7 @@ input_function (tree fn_decl, struct dat
struct cgraph_edge *cedge;
basic_block bb;
struct cgraph_node *node;
- unsigned HOST_WIDE_INT flags;
+ unsigned HOST_WIDEST_INT flags;
fn = DECL_STRUCT_FUNCTION (fn_decl);
tag = input_record_start (ib);
@@ -1901,7 +1901,7 @@ input_function (tree fn_decl, struct dat
/* Read all the attributes for FN. Note that flags are decoded in
the opposite order that they were encoded by output_function. */
- flags = lto_input_uleb128 (ib);
+ flags = lto_input_widest_uint_uleb128 (ib);
fn->va_list_gpr_size = lto_get_flags (&flags, 8);
fn->va_list_fpr_size = lto_get_flags (&flags, 8);
Index: lto-cgraph.c
===================================================================
--- lto-cgraph.c (revision 147465)
+++ lto-cgraph.c (working copy)
@@ -187,7 +187,7 @@ output_edge (struct lto_simple_output_bl
LTO_DEBUG_TOKEN ("flags");
lto_set_flag (&flags, edge->indirect_call);
lto_set_flag (&flags, edge->call_stmt_cannot_inline_p);
- lto_output_uleb128_stream (ob->main_stream, flags);
+ lto_output_widest_uint_uleb128_stream (ob->main_stream, flags);
LTO_DEBUG_UNDENT();
}
@@ -287,7 +287,7 @@ output_node (struct lto_simple_output_bl
lto_set_flag (&flags, node->local.vtable_method);
LTO_DEBUG_TOKEN ("flags");
- lto_output_uleb128_stream (ob->main_stream, flags);
+ lto_output_widest_uint_uleb128_stream (ob->main_stream, flags);
if (tag != LTO_cgraph_unavail_node)
{
@@ -571,7 +571,7 @@ input_edge (struct lto_input_block *ib,
nest = lto_input_uleb128 (ib);
LTO_DEBUG_TOKEN ("flags");
- flags = lto_input_uleb128 (ib);
+ flags = lto_input_widest_uint_uleb128 (ib);
/* If the caller was preempted, don't create the edge. */
if (caller_resolution == LDPR_PREEMPTED_REG
Index: ChangeLog.lto
===================================================================
--- ChangeLog.lto (revision 147465)
+++ ChangeLog.lto (working copy)
@@ -1,3 +1,21 @@
+2009-05-13 H.J. Lu <hongjiu.lu@intel.com>
+
+ * ipa-pure-const.c (write_summary): Replace
+ lto_output_uleb128_stream with
+ lto_output_widest_uint_uleb128_stream on HOST_WIDEST_INT.
+ (read_summary): Replace lto_input_uleb128 with
+ lto_input_widest_uint_uleb128 on HOST_WIDEST_INT.
+
+ * lto-cgraph.c (output_edge): Replace lto_output_uleb128_stream
+ with lto_output_widest_uint_uleb128_stream on HOST_WIDEST_INT.
+ (output_node): Likewise.
+ (input_edge): Replace lto_input_uleb128 with
+ lto_input_widest_uint_uleb128 on HOST_WIDEST_INT.
+
+ * lto-function-in.c (input_function): Use HOST_WIDEST_INT
+ for flags.
+ * lto-function-out.c (output_function): Likewise.
+
2009-05-12 Diego Novillo <dnovillo@google.com>
* lto-tree-flags.def: Add public_flag for INTEGER_CSTs.
Index: ipa-pure-const.c
===================================================================
--- ipa-pure-const.c (revision 147465)
+++ ipa-pure-const.c (working copy)
@@ -650,7 +650,7 @@ write_summary (cgraph_node_set set)
lto_set_flag (&flags, fs->looping);
lto_set_flag (&flags, fs->can_throw);
- lto_output_uleb128_stream (ob->main_stream, flags);
+ lto_output_widest_uint_uleb128_stream (ob->main_stream, flags);
}
}
@@ -684,7 +684,7 @@ read_summary (void)
{
unsigned int index = lto_input_uleb128 (ib);
tree fn_decl = lto_file_decl_data_get_fn_decl (file_data, index);
- unsigned HOST_WIDEST_INT flags = lto_input_uleb128 (ib);
+ unsigned HOST_WIDEST_INT flags = lto_input_widest_uint_uleb128 (ib);
funct_state fs = XCNEW (struct funct_state_d);
set_function_state (cgraph_node (fn_decl), fs);