This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PR21391: pruning unused debugging types (c++ bits)


On Tue, Apr 11, 2006 at 09:36:06PM -0400, Aldy Hernandez wrote:

Ping.

> Hi.
> 
> Here are the C++ bits.  Same thing, different FE.
> 
> Bootstrapped and regtested on ppc-linux (only C++).
> 
> OK?
> 
> 	PR/21391
> 	* testsuite/g++.dg/other/unused1.C: New.
> 	* cp/parser.c (cp_parser_cast_expression): Save casted types in used
> 	types hash table.
> 
> Index: testsuite/g++.dg/other/unused1.C
> ===================================================================
> --- testsuite/g++.dg/other/unused1.C	(revision 0)
> +++ testsuite/g++.dg/other/unused1.C	(revision 0)
> @@ -0,0 +1,16 @@
> +/* { dg-do compile } */
> +/* { dg-options "-g" } */
> +
> +/* Make sure we didn't eliminate foo because we thought it was unused.  */
> +
> +struct foo 
> +{
> +    int i;
> +};
> +
> +int bar (void)
> +{
> +    return ((struct foo *)0x1234)->i;
> +}
> +
> +/* { dg-final { scan-assembler "foo" } } */
> Index: cp/parser.c
> ===================================================================
> --- cp/parser.c	(revision 112618)
> +++ cp/parser.c	(working copy)
> @@ -5449,6 +5449,10 @@ cp_parser_cast_expression (cp_parser *pa
>  		   "enumeration type")))
>  	    return error_mark_node;
>  
> +	  /* Save casted types in the function's used types hash table.  */
> +	  if (debug_info_level > DINFO_LEVEL_NONE)
> +	    used_types_insert (TREE_TYPE (type), cfun);
> +
>  	  /* Perform the cast.  */
>  	  expr = build_c_cast (type, expr);
>  	  return expr;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]