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