]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
alloca: fix buf interaction
authorMike Frysinger <vapier@gentoo.org>
Tue, 24 Feb 2015 05:15:41 +0000 (00:15 -0500)
committerMike Frysinger <vapier@gentoo.org>
Tue, 24 Feb 2015 18:29:40 +0000 (13:29 -0500)
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]

ChangeLog
include/alloca.h

index 8ae6cf1f56514a84c17abbc032770aeceeee872d..b8da862dc2f824170c97b64748a378a98b9b4e97 100644 (file)
--- a/ChangeLog
+++ b/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]
index f741d25d5479fde3b8db0e232c0bd20c7291882f..01500259b8482c459738181e58cc138ad494e11a 100644 (file)
@@ -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;                                       \
@@ -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;                                    \