25845f
commit c82f5c0ce5c1c0180fca311ceb29fd2d59da7441
25845f
Author: Joseph Myers <joseph@codesourcery.com>
25845f
Date:   Wed Nov 26 00:45:19 2014 +0000
25845f
25845f
    Fix warning in setjmp/jmpbug.c.
25845f
    
25845f
    This patch fixes a "set but not used" warning in setjmp/jmpbug.c.  A
25845f
    variable is used only to store the result of alloca.  A cast to void
25845f
    is added to avoid the warning, and the variable is made volatile to
25845f
    ensure the call to alloca isn't optimized away for being unused.
25845f
    
25845f
    Tested for x86_64.
25845f
    
25845f
            * setjmp/jmpbug.c (test): Make foo volatile and cast it to
25845f
            void.
25845f
25845f
diff --git a/setjmp/jmpbug.c b/setjmp/jmpbug.c
25845f
index 125977b2f719dbeb..8594c5a8a782b218 100644
25845f
--- a/setjmp/jmpbug.c
25845f
+++ b/setjmp/jmpbug.c
25845f
@@ -14,7 +14,7 @@ static void
25845f
 test (int x)
25845f
 {
25845f
   jmp_buf buf;
25845f
-  char *foo;
25845f
+  char *volatile foo;
25845f
   int arr[100];
25845f
 
25845f
   arr[77] = x;
25845f
@@ -25,6 +25,7 @@ test (int x)
25845f
     }
25845f
 
25845f
   foo = (char *) alloca (128);
25845f
+  (void) foo;
25845f
   sub5 (buf);
25845f
 }
25845f