Trunk 154492 is uncompilable on Cygwin because of incorrect data types in LTO. It compiles with the attached fixes, but I have no write access to the repository. Could someone please apply them?
Best regards Piotr Wyderski
Index: gcc/lto-streamer-out.c =================================================================== --- gcc/lto-streamer-out.c (revision 154492) +++ gcc/lto-streamer-out.c (working copy) @@ -86,7 +86,7 @@ /* Free the string slot pointed-to by P. */ -static void +static void string_slot_free (void *p) { struct string_slot *slot = (struct string_slot *) p; @@ -365,7 +365,7 @@ { unsigned i; REAL_VALUE_TYPE r; - + r = TREE_REAL_CST (expr); bp_pack_value (bp, r.cl, 2); bp_pack_value (bp, r.decimal, 1); @@ -758,7 +758,7 @@ lto_output_chain (struct output_block *ob, tree t, bool ref_p) { int i, count; - + count = list_length (t); output_sleb128 (ob, count); for (i = 0; i < count; i++) @@ -1612,7 +1612,7 @@ output_phi (struct output_block *ob, gimple phi) { unsigned i, len = gimple_phi_num_args (phi); - + output_record_start (ob, lto_gimple_code_to_tag (GIMPLE_PHI)); output_uleb128 (ob, SSA_NAME_VERSION (PHI_RESULT (phi))); @@ -1732,7 +1732,7 @@ gimple stmt = gsi_stmt (bsi); output_gimple_stmt (ob, stmt); - + /* Emit the EH region holding STMT. */ region = lookup_stmt_eh_lp_fn (fn, stmt); if (region != 0) @@ -1785,14 +1785,14 @@ /* The entire header is stream computed here. */ memset (&header, 0, sizeof (struct lto_function_header)); - + /* Write the header. */ header.lto_header.major_version = LTO_major_version; header.lto_header.minor_version = LTO_minor_version; header.lto_header.section_type = section_type; - + header.compressed_size = 0; - + if (section_type == LTO_section_function_body) header.cfg_size = ob->cfg_stream->total_size; header.main_size = ob->main_stream->total_size; @@ -2037,7 +2037,7 @@ VEC_safe_push (tree, heap, encoder->trees, trees[j]); encoder->next_index = n; } - + lto_free_section_data (file_data, LTO_section_function_body, name, data, len); free (output_stream); @@ -2122,7 +2122,7 @@ }; -/* Write each node in encoded by ENCODER to OB, as well as those reachable +/* Write each node in encoded by ENCODER to OB, as well as those reachable from it and required for correct representation of its semantics. Each node in ENCODER must be a global declaration or a type. A node is written only once, even if it appears multiple times in the @@ -2230,7 +2230,7 @@ unsigned i; int32_t ref; tree decl; - + /* Write reference to FUNCTION_DECL. If there is not function, write reference to void_type_node. */ decl = (state->fn_decl) ? state->fn_decl : void_type_node; @@ -2280,7 +2280,7 @@ const char *name; enum gcc_plugin_symbol_kind kind; enum gcc_plugin_symbol_visibility visibility; - int slot_num; + int32_t slot_num; uint64_t size; const char *comdat; @@ -2442,7 +2442,7 @@ needed. */ output_unreferenced_globals (set); - memset (&header, 0, sizeof (struct lto_decl_header)); + memset (&header, 0, sizeof (struct lto_decl_header)); section_name = lto_get_section_name (LTO_section_decls, NULL); lto_begin_section (section_name, !flag_wpa); @@ -2488,7 +2488,7 @@ lto_output_data_stream (header_stream, &header, sizeof header); lto_write_stream (header_stream); free (header_stream); - + /* Write the main out-decl state, followed by out-decl states of functions. */ decl_state_stream = ((struct lto_output_stream *) @@ -2504,7 +2504,7 @@ lto_output_decl_state_refs (ob, decl_state_stream, fn_out_state); } lto_write_stream (decl_state_stream); - free(decl_state_stream); + free(decl_state_stream); lto_write_stream (ob->main_stream); lto_write_stream (ob->string_stream); Index: gcc/lto-streamer-in.c =================================================================== --- gcc/lto-streamer-in.c (revision 154492) +++ gcc/lto-streamer-in.c (working copy) @@ -140,7 +140,7 @@ unsigned int len; unsigned int loc; const char *result; - + loc = lto_input_uleb128 (ib); LTO_INIT_INPUT_BLOCK (str_tab, data_in->strings, loc, data_in->strings_len); len = lto_input_uleb128 (&str_tab); @@ -148,7 +148,7 @@ if (str_tab.p + len > data_in->strings_len) internal_error ("bytecode stream: string too long for the string table"); - + result = (const char *)(data_in->strings + str_tab.p); return result; @@ -220,7 +220,7 @@ { enum LTO_tags tag = (enum LTO_tags) lto_input_uleb128 (ib); return tag; -} +} /* Lookup STRING in file_name_hash_table. If found, return the existing @@ -311,7 +311,7 @@ function scope for the read tree. */ static tree -lto_input_tree_ref (struct lto_input_block *ib, struct data_in *data_in, +lto_input_tree_ref (struct lto_input_block *ib, struct data_in *data_in, struct function *fn, enum LTO_tags tag) { unsigned HOST_WIDE_INT ix_u; @@ -606,7 +606,7 @@ HOST_WIDE_INT i, root_region, len; enum LTO_tags tag; static bool eh_initialized_p = false; - + tag = input_record_start (ib); if (tag == LTO_null) return; @@ -718,7 +718,7 @@ /* Read the CFG for function FN from input block IB. */ -static void +static void input_cfg (struct lto_input_block *ib, struct function *fn) { unsigned int bb_count; @@ -729,7 +729,7 @@ init_empty_tree_cfg_for_function (fn); init_ssa_operands (); - profile_status_for_function (fn) = + profile_status_for_function (fn) = (enum profile_status_d) lto_input_uleb128 (ib); bb_count = lto_input_uleb128 (ib); @@ -740,7 +740,7 @@ basic_block_info_for_function (fn), bb_count); if (bb_count > VEC_length (basic_block, label_to_block_map_for_function (fn))) - VEC_safe_grow_cleared (basic_block, gc, + VEC_safe_grow_cleared (basic_block, gc, label_to_block_map_for_function (fn), bb_count); index = lto_input_sleb128 (ib); @@ -771,7 +771,7 @@ dest = BASIC_BLOCK_FOR_FUNCTION (fn, dest_index); - if (dest == NULL) + if (dest == NULL) dest = make_new_block (fn, dest_index); e = make_edge (bb, dest, edge_flags); @@ -822,10 +822,10 @@ int src_index = lto_input_uleb128 (ib); location_t arg_loc = lto_input_location (ib, data_in); basic_block sbb = BASIC_BLOCK_FOR_FUNCTION (fn, src_index); - + edge e = NULL; int j; - + for (j = 0; j < len; j++) if (EDGE_PRED (bb, j)->src == sbb) { @@ -833,7 +833,7 @@ break; } - add_phi_arg (result, def, e, arg_loc); + add_phi_arg (result, def, e, arg_loc); } return result; @@ -870,7 +870,7 @@ set_default_def (SSA_NAME_VAR (ssa_name), ssa_name); i = lto_input_uleb128 (ib); - } + } } @@ -1146,12 +1146,12 @@ return stmt; } - + /* Read a basic block with tag TAG from DATA_IN using input block IB. FN is the function being processed. */ static void -input_bb (struct lto_input_block *ib, enum LTO_tags tag, +input_bb (struct lto_input_block *ib, enum LTO_tags tag, struct data_in *data_in, struct function *fn) { unsigned int index; @@ -1257,7 +1257,7 @@ /* Read the body of function FN_DECL from DATA_IN using input block IB. */ static void -input_function (tree fn_decl, struct data_in *data_in, +input_function (tree fn_decl, struct data_in *data_in, struct lto_input_block *ib) { struct function *fn; @@ -1303,12 +1303,12 @@ /* Read all function arguments. We need to re-map them here to the arguments of the merged function declaration. */ - args = lto_input_tree (ib, data_in); + args = lto_input_tree (ib, data_in); for (oarg = args, narg = DECL_ARGUMENTS (fn_decl); oarg && narg; oarg = TREE_CHAIN (oarg), narg = TREE_CHAIN (narg)) { - int ix; + int32_t ix; bool res; res = lto_streamer_cache_lookup (data_in->reader_cache, oarg, &ix); gcc_assert (res); @@ -1363,7 +1363,7 @@ fixup_call_stmt_edges (node, stmts); execute_all_ipa_stmt_fixups (node, stmts); - update_ssa (TODO_update_ssa_only_virtuals); + update_ssa (TODO_update_ssa_only_virtuals); free_dominance_info (CDI_DOMINATORS); free_dominance_info (CDI_POST_DOMINATORS); free (stmts); @@ -1390,7 +1390,7 @@ { const char *orig_name, *new_name; alias_pair *p; - + p = VEC_safe_push (alias_pair, gc, alias_pairs, NULL); p->decl = var; p->target = lto_input_tree (ib, data_in); @@ -1414,7 +1414,7 @@ section type is LTO_section_function_body, FN must be the decl for that function. */ -static void +static void lto_read_body (struct lto_file_decl_data *file_data, tree fn_decl, const char *data, enum lto_section_type section_type) { @@ -1427,7 +1427,7 @@ struct lto_input_block ib_main; header = (const struct lto_function_header *) data; - cfg_offset = sizeof (struct lto_function_header); + cfg_offset = sizeof (struct lto_function_header); main_offset = cfg_offset + header->cfg_size; string_offset = main_offset + header->main_size; @@ -1440,7 +1440,7 @@ data + main_offset, 0, header->main_size); - + data_in = lto_data_in_create (file_data, data + string_offset, header->string_size, NULL); @@ -1482,7 +1482,7 @@ pop_cfun (); } - else + else { input_alias_pairs (&ib_main, data_in); } @@ -1495,7 +1495,7 @@ /* Read the body of FN_DECL using DATA. FILE_DATA holds the global decls and types. */ -void +void lto_input_function_body (struct lto_file_decl_data *file_data, tree fn_decl, const char *data) { @@ -1507,7 +1507,7 @@ /* Read in VAR_DECL using DATA. FILE_DATA holds the global decls and types. */ -void +void lto_input_constructors_and_inits (struct lto_file_decl_data *file_data, const char *data) { @@ -1586,7 +1586,7 @@ unsigned i; REAL_VALUE_TYPE r; REAL_VALUE_TYPE *rp; - + r.cl = (unsigned) bp_unpack_value (bp, 2); r.decimal = (unsigned) bp_unpack_value (bp, 1); r.sign = (unsigned) bp_unpack_value (bp, 1); @@ -1609,7 +1609,7 @@ unpack_ts_fixed_cst_value_fields (struct bitpack_d *bp, tree expr) { struct fixed_value fv; - + fv.data.low = (HOST_WIDE_INT) bp_unpack_value (bp, HOST_BITS_PER_WIDE_INT); fv.data.high = (HOST_WIDE_INT) bp_unpack_value (bp, HOST_BITS_PER_WIDE_INT); TREE_FIXED_CST (expr) = fv; @@ -1954,7 +1954,7 @@ { int i, count; tree first, prev, curr; - + first = prev = NULL_TREE; count = lto_input_sleb128 (ib); for (i = 0; i < count; i++) @@ -1972,7 +1972,7 @@ return first; } - + /* Read all pointer fields in the TS_COMMON structure of EXPR from input block IB. DATA_IN contains tables and descriptors for the file being read. */ @@ -2073,7 +2073,7 @@ struct data_in *data_in, tree expr) { tree id; - + id = lto_input_tree (ib, data_in); if (id) { @@ -2417,7 +2417,7 @@ confuse any attempt to unmangle it. */ const char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); char *label; - + ASM_FORMAT_PRIVATE_NAME (label, name, DECL_UID (decl)); SET_DECL_ASSEMBLER_NAME (decl, get_identifier (label)); rest_of_decl_compilation (decl, 1, 0); @@ -2428,7 +2428,7 @@ declaration for merging. */ if (TREE_PUBLIC (decl)) { - int ix; + int32_t ix; if (!lto_streamer_cache_lookup (data_in->reader_cache, decl, &ix)) gcc_unreachable (); lto_symtab_register_decl (decl, get_resolution (data_in, ix), @@ -2462,7 +2462,7 @@ attempt to unmangle it. */ const char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); char *label; - + ASM_FORMAT_PRIVATE_NAME (label, name, DECL_UID (decl)); SET_DECL_ASSEMBLER_NAME (decl, get_identifier (label)); @@ -2484,18 +2484,18 @@ /* Also register the reverse mapping so that we can find the new name given to an existing assembler name (used when - restoring alias pairs in input_constructors_or_inits. */ + restoring alias pairs in input_constructors_or_inits. */ lto_record_renamed_decl (data_in->file_data, IDENTIFIER_POINTER (new_assembler_name), IDENTIFIER_POINTER (old_assembler_name)); - } + } } /* If this variable has already been declared, queue the declaration for merging. */ if (TREE_PUBLIC (decl) && !DECL_ABSTRACT (decl)) { - int ix; + int32_t ix; if (!lto_streamer_cache_lookup (data_in->reader_cache, decl, &ix)) gcc_unreachable (); lto_symtab_register_decl (decl, get_resolution (data_in, ix), @@ -2663,7 +2663,7 @@ { enum LTO_tags tag; tree result; - + tag = input_record_start (ib); gcc_assert ((unsigned) tag < (unsigned) LTO_NUM_TAGS); Index: gcc/lto-streamer.c =================================================================== --- gcc/lto-streamer.c (revision 154492) +++ gcc/lto-streamer.c (working copy) @@ -190,7 +190,7 @@ fprintf (stderr, "[%s] # of input files: " HOST_WIDE_INT_PRINT_UNSIGNED "\n", s, lto_stats.num_input_files); - fprintf (stderr, "[%s] # of input cgraph nodes: " + fprintf (stderr, "[%s] # of input cgraph nodes: " HOST_WIDE_INT_PRINT_UNSIGNED "\n", s, lto_stats.num_input_cgraph_nodes); @@ -544,7 +544,7 @@ *ix_p = ix; if (offset_p) - *offset_p = offset; + *offset_p = offset; return existed_p; } @@ -589,12 +589,12 @@ bool lto_streamer_cache_lookup (struct lto_streamer_cache_d *cache, tree t, - int *ix_p) + int32_t *ix_p) { void **slot; struct tree_int_map d_slot; bool retval; - int ix; + int32_t ix; gcc_assert (t); @@ -697,7 +697,7 @@ These should be assured in pass_ipa_free_lang_data. */ gcc_assert (fileptr_type_node == ptr_type_node); gcc_assert (TYPE_MAIN_VARIANT (fileptr_type_node) == ptr_type_node); - + seen_nodes = pointer_set_create (); /* Skip itk_char. char_type_node is shared with the appropriately @@ -816,7 +816,7 @@ session can be started on both reader and writer using ORIG_T as a breakpoint value in both sessions. - Note that this mapping is transient and only valid while T is + Note that this mapping is transient and only valid while T is being reconstructed. Once T is fully built, the mapping is removed. */ Index: gcc/lto-streamer.h =================================================================== --- gcc/lto-streamer.h (revision 154492) +++ gcc/lto-streamer.h (working copy) @@ -61,7 +61,7 @@ entry, there is word with the offset within the section to the entry. - 7) THE LABEL NAMES. + 7) THE LABEL NAMES. Since most labels do not have names, this section my be of zero length. It consists of an array of string table references, one @@ -70,18 +70,18 @@ the negative ones do not. The positive index can be used to find the name in this array. - 9) THE CFG. + 9) THE CFG. 10) Index into the local decls. Since local decls can have local decls inside them, they must be read in randomly in order to - properly restore them. + properly restore them. 11-12) GIMPLE FOR THE LOCAL DECLS AND THE FUNCTION BODY. The gimple consists of a set of records. THE FUNCTION - + At the top level of (8) is the function. It consists of five pieces: @@ -172,7 +172,7 @@ (GIMPLE statements, basic blocks, EH regions, tree nodes, etc). NOTE, when adding new LTO tags, also update lto_tag_name. */ -enum LTO_tags +enum LTO_tags { LTO_null = 0, @@ -284,7 +284,7 @@ /* Macro to define convenience functions for type and decl streams - in lto_file_decl_data. */ + in lto_file_decl_data. */ #define DEFINE_DECL_STREAM_FUNCS(UPPER_NAME, name) \ static inline tree \ lto_file_decl_data_get_ ## name (struct lto_file_decl_data *data, \ @@ -307,17 +307,17 @@ or function. The first parameter is the file data that contains the information. The second parameter is the type of information to be obtained. The third parameter is the name of the function - and is only used when finding a function body; otherwise it is + and is only used when finding a function body; otherwise it is NULL. The fourth parameter is the length of the data returned. */ -typedef const char* (lto_get_section_data_f) (struct lto_file_decl_data *, +typedef const char* (lto_get_section_data_f) (struct lto_file_decl_data *, enum lto_section_type, - const char *, + const char *, size_t *); /* Return the data found from the above call. The first three parameters are the same as above. The fourth parameter is the data itself and the fifth is the lenght of the data. */ -typedef void (lto_free_section_data_f) (struct lto_file_decl_data *, +typedef void (lto_free_section_data_f) (struct lto_file_decl_data *, enum lto_section_type, const char *, const char *, @@ -357,7 +357,7 @@ /* Structure used as buffer for reading an LTO file. */ -struct lto_input_block +struct lto_input_block { const char *data; unsigned int p; @@ -673,7 +673,7 @@ /* Number of named labels. Used to find the index of unnamed labels since they share space with the named labels. */ - unsigned int num_named_labels; + unsigned int num_named_labels; /* Number of unnamed labels. */ unsigned int num_unnamed_labels; @@ -692,13 +692,13 @@ /* In lto-section-in.c */ extern struct lto_input_block * lto_create_simple_input_block ( - struct lto_file_decl_data *, + struct lto_file_decl_data *, enum lto_section_type, const char **, size_t *); extern void -lto_destroy_simple_input_block (struct lto_file_decl_data *, +lto_destroy_simple_input_block (struct lto_file_decl_data *, enum lto_section_type, struct lto_input_block *, const char *, size_t); -extern void lto_set_in_hooks (struct lto_file_decl_data **, +extern void lto_set_in_hooks (struct lto_file_decl_data **, lto_get_section_data_f *, lto_free_section_data_f *); extern struct lto_file_decl_data **lto_get_file_decl_data (void); @@ -788,7 +788,7 @@ extern bool lto_streamer_cache_insert_at (struct lto_streamer_cache_d *, tree, int); extern bool lto_streamer_cache_lookup (struct lto_streamer_cache_d *, tree, - int *); + int32_t *); extern tree lto_streamer_cache_get (struct lto_streamer_cache_d *, int); extern struct lto_streamer_cache_d *lto_streamer_cache_create (void); extern void lto_streamer_cache_delete (struct lto_streamer_cache_d *);