[lto]: Patch to fix the chaining of local variables.

Kenneth Zadeck zadeck@naturalbridge.com
Mon Dec 17 14:30:00 GMT 2007

This patch fixes two and a half problems:

1) The unexpanded_vars_list was not being restored properly.  It is now
restored in the same order but there are not duplicates in the chain as
there are on the sending side.

2) I do not output the DECL_CHAIN field for local variables.  This was
causing a deep recursion on reading in the local variables that was
blowing the stack on some large functions.

2.5) We now properly serialize the DECL_CONTEXT for FUNCTION_DECLS. 
This is only marked as a half of a fix because there is something else
(perhaps the asm section name) that must be serialized properly to get
nested functions to work.  But this was part of the problem.

This now leaves only 1 failure when compiling the gcc .i files. 

committed as revision 131009.


2007-12-17  Kenneth Zadeck <zadeck@naturalbridge.com>

    * lto-function-out.c (output_block.unexpanded_local_decls_index):
New vector.
    (destroy_output_block): Added missing ifdef.
    (output_decl_index): Added this_index to return added index.
    (output_type_ref): Added parameter to output_decl_index.
    (output_local_decl_ref): Added write parameter and code to initialize
    (output_expr_operand): Added extra operands to output_decl_index and
    (output_local_var): New function split out from output_local_vars.
    (output_local_vars): Added code to string unexpanded_var_list
    (output_function): Added code to output decl_context for function.
2007-12-17  Kenneth Zadeck <zadeck@naturalbridge.com>

    * lto_read.c (data_in.unexpanded_indexes): New array.
    (input_local_var): Added code to read in unexpanded_var_list
    indexes for variables.  Only read in DECL_CHAIN field for
    (input_local_vars): Added code to rebuild unexpanded_var_list in
    order using unexpanded_indexes.
    (input_function): Added code to set DECL_CONTEXT for functions.

More information about the Gcc-patches mailing list