Bug 43681 - [4.6 Regression] bootstrap fails with "unused" var message for an apparently used var.
Summary: [4.6 Regression] bootstrap fails with "unused" var message for an apparently ...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: bootstrap (show other bugs)
Version: 4.6.0
: P3 blocker
Target Milestone: 4.6.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-07 23:47 UTC by Iain Sandoe
Modified: 2010-04-13 19:46 UTC (History)
2 users (show)

See Also:
Host:
Target: powerpc-apple-darwin9
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
gcc46-pr43681.patch (409 bytes, patch)
2010-04-08 07:00 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Iain Sandoe 2010-04-07 23:47:30 UTC
158099.
cc1: warnings being treated as errors
/GCC/gcc-live-trunk/gcc/expr.c: In function ‘block_move_libcall_safe_for_call_parm’:
/GCC/gcc-live-trunk/gcc/expr.c:1254:8: error: variable ‘fn’ set but not used
make[3]: *** [expr.o] Error 1

BUT:
======
static bool
block_move_libcall_safe_for_call_parm (void)
{
#if defined (REG_PARM_STACK_SPACE)
1254==>>>  tree fn;
#endif

  /* If arguments are pushed on the stack, then they're safe.  */
  if (PUSH_ARGS)
    return true;

  /* If registers go on the stack anyway, any argument is sure to clobber
     an outgoing argument.  */
#if defined (REG_PARM_STACK_SPACE)
  fn = emit_block_move_libcall_fn (false);
  if (OUTGOING_REG_PARM_STACK_SPACE ((!fn ? NULL_TREE : TREE_TYPE (fn)))
      && REG_PARM_STACK_SPACE (fn) != 0)
    return false;
#endif

  /* If any argument goes in memory, then it might clobber an outgoing
Comment 1 Jakub Jelinek 2010-04-08 07:00:23 UTC
Created attachment 20331 [details]
gcc46-pr43681.patch

Untested patch.
Comment 2 Iain Sandoe 2010-04-08 08:59:53 UTC
(In reply to comment #1)
> Created an attachment (id=20331) [edit]
> gcc46-pr43681.patch
> 
> Untested patch.

yes, thanks that works.
- I couldn't see what to do there; 
see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43684
 for the ones I think I can resolve. 

Comment 3 Jakub Jelinek 2010-04-08 10:12:51 UTC
Subject: Bug 43681

Author: jakub
Date: Thu Apr  8 10:12:35 2010
New Revision: 158111

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=158111
Log:
	PR bootstrap/43681
	* expr.c (block_move_libcall_safe_for_call_parm): Avoid
	set but not used variable warning.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/expr.c

Comment 4 Iain Sandoe 2010-04-08 15:07:39 UTC
bootstrapped {powerpc,i686}-apple-darwin9.
this is fixed. 
(other 'set but not used'  issues at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43684 remain)
Comment 5 Uroš Bizjak 2010-04-13 19:46:55 UTC
(In reply to comment #1)
> Created an attachment (id=20331) [edit]
> gcc46-pr43681.patch
> 
> Untested patch.

How about:

Index: expr.c
===================================================================
--- expr.c	(revision 158277)
+++ expr.c	(working copy)
@@ -1251,7 +1251,7 @@
 block_move_libcall_safe_for_call_parm (void)
 {
 #if defined (REG_PARM_STACK_SPACE)
-  tree fn;
+  tree fn ATTRIBUTE_UNUSED;
 #endif
 
   /* If arguments are pushed on the stack, then they're safe.  */