re PR debug/23336 (enum constants not visible to gdb because of -feliminate-unused-debug-types)

gcc/
	PR debug/23336
	* c-typeck.c (build_external_type): Mark used enum types.
	* dwarf2out.c (dwarf2out_abstract_function): Save and restore
	cfun also.
	(gen_subprogram_die): Whitespace fix.
gcc/cp/
	PR debug/23336
	* pt.c (tsubst_copy_and_build): Mark used enum types.
	* semantics.c (finish_id_expression): Likewise.
gcc/testsuite/
	PR debug/23336
	* lib/gcc-dg.exp (gcc-dg-debug-runtest): Suppress new tests
	at -g1.
	* gcc.dg/debug/enum-1.c, g++.dg/debug/enum-1.C,
	g++.dg/debug/enum-2.C: New.

From-SVN: r115853
This commit is contained in:
Daniel Jacobowitz 2006-08-01 14:23:58 +00:00 committed by Daniel Jacobowitz
parent 9824b8867a
commit 6193b8b7ed
11 changed files with 96 additions and 4 deletions

View file

@ -1,3 +1,11 @@
2006-08-01 Daniel Jacobowitz <dan@codesourcery.com>
PR debug/23336
* c-typeck.c (build_external_type): Mark used enum types.
* dwarf2out.c (dwarf2out_abstract_function): Save and restore
cfun also.
(gen_subprogram_die): Whitespace fix.
2006-08-01 Jan Hubicka <jh@suse.cz>
* tree-outof-ssa.c (check_replaceable): Do not allocate def_vars

View file

@ -2067,6 +2067,7 @@ build_external_ref (tree id, int fun, location_t loc)
if (TREE_CODE (ref) == CONST_DECL)
{
used_types_insert (TREE_TYPE (ref));
ref = DECL_INITIAL (ref);
TREE_CONSTANT (ref) = 1;
TREE_INVARIANT (ref) = 1;

View file

@ -1,3 +1,9 @@
2006-08-01 Daniel Jacobowitz <dan@codesourcery.com>
PR debug/23336
* pt.c (tsubst_copy_and_build): Mark used enum types.
* semantics.c (finish_id_expression): Likewise.
2006-07-31 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/6634

View file

@ -9240,7 +9240,10 @@ tsubst_copy_and_build (tree t,
/* As in finish_id_expression, we resolve enumeration constants
to their underlying values. */
if (TREE_CODE (t) == CONST_DECL)
return DECL_INITIAL (t);
{
used_types_insert (TREE_TYPE (t));
return DECL_INITIAL (t);
}
return t;
default:

View file

@ -2589,7 +2589,10 @@ finish_id_expression (tree id_expression,
{
*idk = CP_ID_KIND_NONE;
if (!processing_template_decl)
return DECL_INITIAL (decl);
{
used_types_insert (TREE_TYPE (decl));
return DECL_INITIAL (decl);
}
return decl;
}
else

View file

@ -11457,6 +11457,7 @@ dwarf2out_abstract_function (tree decl)
{
dw_die_ref old_die;
tree save_fn;
struct function *save_cfun;
tree context;
int was_abstract = DECL_ABSTRACT (decl);
@ -11480,7 +11481,9 @@ dwarf2out_abstract_function (tree decl)
/* Pretend we've just finished compiling this function. */
save_fn = current_function_decl;
save_cfun = cfun;
current_function_decl = decl;
cfun = DECL_STRUCT_FUNCTION (decl);
set_decl_abstract_flags (decl, 1);
dwarf2out_decl (decl);
@ -11488,6 +11491,7 @@ dwarf2out_abstract_function (tree decl)
set_decl_abstract_flags (decl, 0);
current_function_decl = save_fn;
cfun = save_cfun;
}
/* Helper function of premark_used_types() which gets called through
@ -11531,7 +11535,7 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
int declaration = (current_function_decl != decl
|| class_or_namespace_scope_p (context_die));
premark_used_types();
premark_used_types ();
/* It is possible to have both DECL_ABSTRACT and DECLARATION be true if we
started to generate the abstract instance of an inline, decided to output

View file

@ -1,3 +1,11 @@
2006-08-01 Daniel Jacobowitz <dan@codesourcery.com>
PR debug/23336
* lib/gcc-dg.exp (gcc-dg-debug-runtest): Suppress new tests
at -g1.
* gcc.dg/debug/enum-1.c, g++.dg/debug/enum-1.C,
g++.dg/debug/enum-2.C: New.
2006-07-31 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/6634

View file

@ -0,0 +1,16 @@
/* Verify that used enums are output. */
/* { dg-do compile } */
/* { dg-final { scan-assembler "JTI_MAX" } } */
int var;
enum java_tree_index
{
JTI_MAX
};
void function (void)
{
var = JTI_MAX;
}

View file

@ -0,0 +1,22 @@
/* Verify that used enums are output. */
/* { dg-do compile } */
/* { dg-final { scan-assembler "JTI_MAX" } } */
int var;
enum java_tree_index
{
JTI_MAX
};
template<int X>
void tmpl (void)
{
var = JTI_MAX + X;
}
void
function (void)
{
tmpl<2>();
}

View file

@ -0,0 +1,16 @@
/* Verify that used enums are output. */
/* { dg-do compile } */
/* { dg-final { scan-assembler "JTI_MAX" } } */
int var;
enum java_tree_index
{
JTI_MAX
};
void function (void)
{
var = JTI_MAX;
}

View file

@ -292,7 +292,12 @@ proc gcc-dg-debug-runtest { target_compile trivial opt_opts testcases } {
foreach flags $DEBUG_TORTURE_OPTIONS {
set doit 1
if { [string match {*/debug-[126].c} "$nshort"] \
# These tests check for information which may be deliberately
# suppressed at -g1.
if { ([string match {*/debug-[126].c} "$nshort"] \
|| [string match {*/enum-1.c} "$nshort"] \
|| [string match {*/enum-[12].C} "$nshort"]) \
&& [string match "*1" [lindex "$flags" 0] ] } {
set doit 0
}