Patchwork Adjustment to DW_TAG_GNU_call_site patch for ICF debug

login
register
mail settings
Submitter Jakub Jelinek
Date March 16, 2011, 10:21 a.m.
Message ID <20110316102102.GH30899@tyan-ft48-01.lab.bos.redhat.com>
Download mbox | patch
Permalink /patch/87218/
State New
Headers show

Comments

Jakub Jelinek - March 16, 2011, 10:21 a.m.
On Wed, Mar 16, 2011 at 11:11:07AM +0100, Andreas Schwab wrote:
> Jakub Jelinek <jakub@redhat.com> writes:
> 
> > +	    {
> > +	      int nargs = list_length (TYPE_ARG_TYPES (type));
> > +	      link = CALL_INSN_FUNCTION_USAGE (insn);
> 
> ../../gcc/var-tracking.c: In function 'prepare_call_arguments':
> ../../gcc/var-tracking.c:5623:12: error: unused variable 'nargs' [-Werror=unused-variable]

You didn't say which target it is.  Anyway, guess on your target
INIT_CUMULATIVE_ARGS macro ignores the last argument.
Will commit this as obvious (using list_length directly in
INIT_CUMULATIVE_ARGS isn't a good choice, because some targets might
evaluate it more than once):

2011-03-16  Jakub Jelinek  <jakub@redhat.com>

	* var-tracking.c (prepare_call_arguments): Add ATTRIBUTE_UNUSED
	to nargs.



	Jakub

Patch

--- gcc/var-tracking.c.jj	2011-03-16 09:36:12.000000000 +0100
+++ gcc/var-tracking.c	2011-03-16 11:16:04.074671156 +0100
@@ -5620,7 +5620,7 @@  prepare_call_arguments (basic_block bb, 
 	    type = NULL;
 	  else
 	    {
-	      int nargs = list_length (TYPE_ARG_TYPES (type));
+	      int nargs ATTRIBUTE_UNUSED = list_length (TYPE_ARG_TYPES (type));
 	      link = CALL_INSN_FUNCTION_USAGE (insn);
 #ifndef PCC_STATIC_STRUCT_RETURN
 	      if (aggregate_value_p (TREE_TYPE (type), type)