This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Fix warning in setjmp/jmpbug.c
- From: Joseph Myers <joseph at codesourcery dot com>
- To: <libc-alpha at sourceware dot org>
- Date: Wed, 26 Nov 2014 00:37:49 +0000
- Subject: Fix warning in setjmp/jmpbug.c
- Authentication-results: sourceware.org; auth=none
This patch fixes a "set but not used" warning in setjmp/jmpbug.c. A
variable is used only to store the result of alloca. A cast to void
is added to avoid the warning, and the variable is made volatile to
ensure the call to alloca isn't optimized away for being unused.
Tested for x86_64.
2014-11-26 Joseph Myers <joseph@codesourcery.com>
* setjmp/jmpbug.c (test): Make foo volatile and cast it to
void.
diff --git a/setjmp/jmpbug.c b/setjmp/jmpbug.c
index 125977b..8594c5a 100644
--- a/setjmp/jmpbug.c
+++ b/setjmp/jmpbug.c
@@ -14,7 +14,7 @@ static void
test (int x)
{
jmp_buf buf;
- char *foo;
+ char *volatile foo;
int arr[100];
arr[77] = x;
@@ -25,6 +25,7 @@ test (int x)
}
foo = (char *) alloca (128);
+ (void) foo;
sub5 (buf);
}
--
Joseph S. Myers
joseph@codesourcery.com