* Fix warning in setjmp/jmpbug.c
@ 2014-11-26 0:37 Joseph Myers
2014-11-26 0:41 ` Ondřej Bílka
0 siblings, 1 reply; 2+ messages in thread
From: Joseph Myers @ 2014-11-26 0:37 UTC (permalink / raw)
To: libc-alpha
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Fix warning in setjmp/jmpbug.c
2014-11-26 0:37 Fix warning in setjmp/jmpbug.c Joseph Myers
@ 2014-11-26 0:41 ` Ondřej Bílka
0 siblings, 0 replies; 2+ messages in thread
From: Ondřej Bílka @ 2014-11-26 0:41 UTC (permalink / raw)
To: Joseph Myers; +Cc: libc-alpha
On Wed, Nov 26, 2014 at 12:37:49AM +0000, Joseph Myers wrote:
> 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.
>
looks ok.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-11-26 0:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-26 0:37 Fix warning in setjmp/jmpbug.c Joseph Myers
2014-11-26 0:41 ` Ondřej Bílka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).