Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix warning in setjmp/jmpbug.c.
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.

	* setjmp/jmpbug.c (test): Make foo volatile and cast it to
	void.
  • Loading branch information
Joseph Myers committed Nov 26, 2014
1 parent 439e1ad commit c82f5c0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions ChangeLog
@@ -1,3 +1,8 @@
2014-11-26 Joseph Myers <joseph@codesourcery.com>

* setjmp/jmpbug.c (test): Make foo volatile and cast it to
void.

2014-11-25 Joseph Myers <joseph@codesourcery.com>

* stdio-common/tst-printf-round.c (test_hex_in_one_mode): Make
Expand Down
3 changes: 2 additions & 1 deletion setjmp/jmpbug.c
Expand Up @@ -14,7 +14,7 @@ static void
test (int x)
{
jmp_buf buf;
char *foo;
char *volatile foo;
int arr[100];

arr[77] = x;
Expand All @@ -25,6 +25,7 @@ test (int x)
}

foo = (char *) alloca (128);
(void) foo;
sub5 (buf);
}

Expand Down

0 comments on commit c82f5c0

Please sign in to comment.