Commit a418679d by Jan Hubicka Committed by Jan Hubicka

re PR debug/26881 (internal compiler error in dwarf2out_finish)

	PR debug/26881
	* cgraph.c: Fix comments.
	(cgraph_varpool_mark_needed_node): Mark only variables not already
	output to file.
	* cgraphunit.c: Update comments; include gt-cgraphunit.h
	(cgraph_varpool_assembled_nodes_queue): New static variable.
	(cgraph_varpool_assemble_decl): Record output decls for debug out code.
	(cgraph_varpool_output_debug_info): New function.
	(cgraph_finalize_compilation_unit, cgraph_optimize): Call it.
	* Makefile.in: Add gt-cgraphunit.h
	* gcc.dg/debug/pr26881.c: New file.

From-SVN: r116374
parent 96f4873b
2006-08-24 Jan Hubicka <jh@suse.cz> 2006-08-24 Jan Hubicka <jh@suse.cz>
PR debug/26881
* cgraph.c: Fix comments.
(cgraph_varpool_mark_needed_node): Mark only variables not already
output to file.
* cgraphunit.c: Update comments; include gt-cgraphunit.h
(cgraph_varpool_assembled_nodes_queue): New static variable.
(cgraph_varpool_assemble_decl): Record output decls for debug out code.
(cgraph_varpool_output_debug_info): New function.
(cgraph_finalize_compilation_unit, cgraph_optimize): Call it.
* Makefile.in: Add gt-cgraphunit.h
2006-08-24 Jan Hubicka <jh@suse.cz>
* predict.c (probability_reliable_p): New predicate. * predict.c (probability_reliable_p): New predicate.
(edge_probability_reliable_p, br_prob_note_reliable_p): Likewise. (edge_probability_reliable_p, br_prob_note_reliable_p): Likewise.
(predict_loops): Do not predict loop exit with less than 2% (predict_loops): Do not predict loop exit with less than 2%
......
...@@ -2290,7 +2290,8 @@ cgraphunit.o : cgraphunit.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ ...@@ -2290,7 +2290,8 @@ cgraphunit.o : cgraphunit.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(TREE_H) langhooks.h $(TREE_INLINE_H) toplev.h $(FLAGS_H) $(GGC_H) \ $(TREE_H) langhooks.h $(TREE_INLINE_H) toplev.h $(FLAGS_H) $(GGC_H) \
$(TARGET_H) $(CGRAPH_H) intl.h pointer-set.h $(FUNCTION_H) $(TREE_GIMPLE_H) \ $(TARGET_H) $(CGRAPH_H) intl.h pointer-set.h $(FUNCTION_H) $(TREE_GIMPLE_H) \
$(TREE_FLOW_H) tree-pass.h $(C_COMMON_H) debug.h $(DIAGNOSTIC_H) \ $(TREE_FLOW_H) tree-pass.h $(C_COMMON_H) debug.h $(DIAGNOSTIC_H) \
$(FIBHEAP_H) output.h $(PARAMS_H) $(RTL_H) $(TIMEVAR_H) ipa-prop.h $(FIBHEAP_H) output.h $(PARAMS_H) $(RTL_H) $(TIMEVAR_H) ipa-prop.h \
gt-cgraphunit.h
ipa.o : ipa.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(CGRAPH_H) ipa.o : ipa.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(CGRAPH_H)
ipa-prop.o : ipa-prop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ ipa-prop.o : ipa-prop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
langhooks.h $(GGC_H) $(TARGET_H) $(CGRAPH_H) ipa-prop.h \ langhooks.h $(GGC_H) $(TARGET_H) $(CGRAPH_H) ipa-prop.h \
...@@ -2867,7 +2868,7 @@ GTFILES = $(srcdir)/input.h $(srcdir)/coretypes.h \ ...@@ -2867,7 +2868,7 @@ GTFILES = $(srcdir)/input.h $(srcdir)/coretypes.h \
$(srcdir)/ipa-reference.c $(srcdir)/tree-ssa-structalias.h \ $(srcdir)/ipa-reference.c $(srcdir)/tree-ssa-structalias.h \
$(srcdir)/tree-ssa-structalias.c \ $(srcdir)/tree-ssa-structalias.c \
$(srcdir)/c-pragma.h $(srcdir)/omp-low.c \ $(srcdir)/c-pragma.h $(srcdir)/omp-low.c \
$(srcdir)/targhooks.c $(out_file) \ $(srcdir)/targhooks.c $(srcdir)/cgraphunit.c $(out_file) \
@all_gtfiles@ @all_gtfiles@
GTFILES_FILES_LANGS = @all_gtfiles_files_langs@ GTFILES_FILES_LANGS = @all_gtfiles_files_langs@
...@@ -2899,7 +2900,7 @@ gt-tree-profile.h gt-tree-ssa-address.h \ ...@@ -2899,7 +2900,7 @@ gt-tree-profile.h gt-tree-ssa-address.h \
gt-tree-ssanames.h gt-tree-iterator.h gt-gimplify.h \ gt-tree-ssanames.h gt-tree-iterator.h gt-gimplify.h \
gt-tree-phinodes.h gt-tree-nested.h \ gt-tree-phinodes.h gt-tree-nested.h \
gt-tree-ssa-operands.h gt-tree-ssa-propagate.h \ gt-tree-ssa-operands.h gt-tree-ssa-propagate.h \
gt-tree-ssa-structalias.h gt-ipa-inline.h \ gt-tree-ssa-structalias.h gt-ipa-inline.h gt-cgraphunit.h \
gt-stringpool.h gt-targhooks.h gt-omp-low.h : s-gtype ; @true gt-stringpool.h gt-targhooks.h gt-omp-low.h : s-gtype ; @true
define echo_quoted_to_gtyp define echo_quoted_to_gtyp
......
...@@ -47,9 +47,9 @@ The callgraph: ...@@ -47,9 +47,9 @@ The callgraph:
be accessed in such an invisible way and it shall be considered an be accessed in such an invisible way and it shall be considered an
entry point to the callgraph. entry point to the callgraph.
Intraprocedural information: Interprocedural information:
Callgraph is place to store data needed for intraprocedural optimization. Callgraph is place to store data needed for interprocedural optimization.
All data structures are divided into three components: local_info that All data structures are divided into three components: local_info that
is produced while analyzing the function, global_info that is result is produced while analyzing the function, global_info that is result
of global walking of the callgraph on the end of compilation and of global walking of the callgraph on the end of compilation and
...@@ -921,7 +921,8 @@ cgraph_varpool_reset_queue (void) ...@@ -921,7 +921,8 @@ cgraph_varpool_reset_queue (void)
void void
cgraph_varpool_mark_needed_node (struct cgraph_varpool_node *node) cgraph_varpool_mark_needed_node (struct cgraph_varpool_node *node)
{ {
if (!node->needed && node->finalized) if (!node->needed && node->finalized
&& !TREE_ASM_WRITTEN (node->decl))
cgraph_varpool_enqueue_needed_node (node); cgraph_varpool_enqueue_needed_node (node);
node->needed = 1; node->needed = 1;
} }
......
/* Callgraph based intraprocedural optimizations. /* Callgraph based interprocedural optimizations.
Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
Contributed by Jan Hubicka Contributed by Jan Hubicka
...@@ -20,7 +20,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA ...@@ -20,7 +20,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */ 02110-1301, USA. */
/* This module implements main driver of compilation process as well as /* This module implements main driver of compilation process as well as
few basic intraprocedural optimizers. few basic interprocedural optimizers.
The main scope of this file is to act as an interface in between The main scope of this file is to act as an interface in between
tree based frontends and the backend (and middle end) tree based frontends and the backend (and middle end)
...@@ -174,6 +174,9 @@ static tree record_reference (tree *, int *, void *); ...@@ -174,6 +174,9 @@ static tree record_reference (tree *, int *, void *);
static void cgraph_output_pending_asms (void); static void cgraph_output_pending_asms (void);
static void cgraph_increase_alignment (void); static void cgraph_increase_alignment (void);
/* Lists all assembled variables to be sent to debugger output later on. */
static GTY(()) struct cgraph_varpool_node *cgraph_varpool_assembled_nodes_queue;
/* Records tree nodes seen in record_reference. Simply using /* Records tree nodes seen in record_reference. Simply using
walk_tree_without_duplicates doesn't guarantee each node is visited walk_tree_without_duplicates doesn't guarantee each node is visited
once because it gets a new htab upon each recursive call from once because it gets a new htab upon each recursive call from
...@@ -856,18 +859,7 @@ cgraph_varpool_assemble_decl (struct cgraph_varpool_node *node) ...@@ -856,18 +859,7 @@ cgraph_varpool_assemble_decl (struct cgraph_varpool_node *node)
&& (TREE_CODE (decl) != VAR_DECL || !DECL_HAS_VALUE_EXPR_P (decl))) && (TREE_CODE (decl) != VAR_DECL || !DECL_HAS_VALUE_EXPR_P (decl)))
{ {
assemble_variable (decl, 0, 1, 0); assemble_variable (decl, 0, 1, 0);
/* Local static variables are never seen by check_global_declarations return TREE_ASM_WRITTEN (decl);
so we need to output debug info by hand. */
if (DECL_CONTEXT (decl)
&& (TREE_CODE (DECL_CONTEXT (decl)) == BLOCK
|| TREE_CODE (DECL_CONTEXT (decl)) == FUNCTION_DECL)
&& errorcount == 0 && sorrycount == 0)
{
timevar_push (TV_SYMOUT);
(*debug_hooks->global_decl) (decl);
timevar_pop (TV_SYMOUT);
}
return true;
} }
return false; return false;
...@@ -893,11 +885,39 @@ cgraph_varpool_assemble_pending_decls (void) ...@@ -893,11 +885,39 @@ cgraph_varpool_assemble_pending_decls (void)
cgraph_varpool_nodes_queue = cgraph_varpool_nodes_queue->next_needed; cgraph_varpool_nodes_queue = cgraph_varpool_nodes_queue->next_needed;
if (cgraph_varpool_assemble_decl (node)) if (cgraph_varpool_assemble_decl (node))
changed = true; {
node->next_needed = NULL; changed = true;
node->next_needed = cgraph_varpool_assembled_nodes_queue;
cgraph_varpool_assembled_nodes_queue = node;
node->finalized = 1;
}
else
node->next_needed = NULL;
} }
return changed; return changed;
} }
/* Output all variables enqueued to be assembled. */
static void
cgraph_varpool_output_debug_info (void)
{
timevar_push (TV_SYMOUT);
if (errorcount == 0 && sorrycount == 0)
while (cgraph_varpool_assembled_nodes_queue)
{
struct cgraph_varpool_node *node = cgraph_varpool_assembled_nodes_queue;
/* Local static variables are never seen by check_global_declarations
so we need to output debug info by hand. */
if (DECL_CONTEXT (node->decl)
&& (TREE_CODE (DECL_CONTEXT (node->decl)) == BLOCK
|| TREE_CODE (DECL_CONTEXT (node->decl)) == FUNCTION_DECL)
&& errorcount == 0 && sorrycount == 0)
(*debug_hooks->global_decl) (node->decl);
cgraph_varpool_assembled_nodes_queue = node->next_needed;
node->next_needed = 0;
}
timevar_pop (TV_SYMOUT);
}
/* Output all asm statements we have stored up to be output. */ /* Output all asm statements we have stored up to be output. */
...@@ -1043,6 +1063,7 @@ cgraph_finalize_compilation_unit (void) ...@@ -1043,6 +1063,7 @@ cgraph_finalize_compilation_unit (void)
{ {
cgraph_output_pending_asms (); cgraph_output_pending_asms ();
cgraph_assemble_pending_functions (); cgraph_assemble_pending_functions ();
cgraph_varpool_output_debug_info ();
return; return;
} }
...@@ -1495,6 +1516,7 @@ cgraph_optimize (void) ...@@ -1495,6 +1516,7 @@ cgraph_optimize (void)
{ {
cgraph_output_pending_asms (); cgraph_output_pending_asms ();
cgraph_varpool_assemble_pending_decls (); cgraph_varpool_assemble_pending_decls ();
cgraph_varpool_output_debug_info ();
return; return;
} }
...@@ -1506,7 +1528,7 @@ cgraph_optimize (void) ...@@ -1506,7 +1528,7 @@ cgraph_optimize (void)
timevar_push (TV_CGRAPHOPT); timevar_push (TV_CGRAPHOPT);
if (!quiet_flag) if (!quiet_flag)
fprintf (stderr, "Performing intraprocedural optimizations\n"); fprintf (stderr, "Performing interprocedural optimizations\n");
cgraph_function_and_variable_visibility (); cgraph_function_and_variable_visibility ();
if (cgraph_dump_file) if (cgraph_dump_file)
...@@ -1551,6 +1573,7 @@ cgraph_optimize (void) ...@@ -1551,6 +1573,7 @@ cgraph_optimize (void)
cgraph_varpool_remove_unreferenced_decls (); cgraph_varpool_remove_unreferenced_decls ();
cgraph_varpool_assemble_pending_decls (); cgraph_varpool_assemble_pending_decls ();
cgraph_varpool_output_debug_info ();
} }
if (cgraph_dump_file) if (cgraph_dump_file)
...@@ -1891,3 +1914,4 @@ save_inline_function_body (struct cgraph_node *node) ...@@ -1891,3 +1914,4 @@ save_inline_function_body (struct cgraph_node *node)
return first_clone; return first_clone;
} }
#include "gt-cgraphunit.h"
2006-08-24 Jan Hubicka <jh@suse.cz>
PR debug/26881
* gcc.dg/debug/pr26881.c: New file.
2006-08-23 Paul Thomas <pault@gcc.gnu.org> 2006-08-23 Paul Thomas <pault@gcc.gnu.org>
PR fortran/28788 PR fortran/28788
/* { dg-do compile } */
/* { dg-options "-g -O0" } */
int
main (int argc, char **argv)
{
if (0)
{
static union
{
}
u;
typedef char tt;
static tt c[8];
return c[0] == 0x01 && c[1] == 0x02;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment