Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
alloca: fix buf interaction
The stack-grows-down case is missing paren around the buf cast.

The stack-grows-up case is missing a cast with the buf assignment.
This leads to build failures due to -Werror:
vfprintf.c: In function '_IO_vfprintf_internal':
vfprintf.c:1738:16: error: initialization from incompatible pointer type [-Werror]
  • Loading branch information
Mike Frysinger committed Feb 24, 2015
1 parent 9438b23 commit ba7d2c5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
@@ -1,3 +1,9 @@
2015-02-24 Mike Frysinger <vapier@gentoo.org>

* include/alloca.h [_STACK_GROWS_DOWN] (extend_alloca): Add
parenthesis around the buf assignment.
[_STACK_GROWS_UP] (extend_alloca): Add a char* cast.

2015-02-24 Joseph Myers <joseph@codesourcery.com>

[BZ #16783]
Expand Down
4 changes: 2 additions & 2 deletions include/alloca.h
Expand Up @@ -28,7 +28,7 @@ libc_hidden_proto (__libc_alloca_cutoff)
# define extend_alloca(buf, len, newlen) \
(__typeof (buf)) ({ size_t __newlen = stackinfo_alloca_round (newlen); \
char *__newbuf = __alloca (__newlen); \
if (__newbuf + __newlen == (char *) buf) \
if (__newbuf + __newlen == (char *) (buf)) \
len += __newlen; \
else \
len = __newlen; \
Expand All @@ -37,7 +37,7 @@ libc_hidden_proto (__libc_alloca_cutoff)
# define extend_alloca(buf, len, newlen) \
(__typeof (buf)) ({ size_t __newlen = stackinfo_alloca_round (newlen); \
char *__newbuf = __alloca (__newlen); \
char *__buf = (buf); \
char *__buf = (char *) (buf); \
if (__buf + len == __newbuf) \
{ \
len += __newlen; \
Expand Down

0 comments on commit ba7d2c5

Please sign in to comment.