]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libssp: Include 'stdlib.h' for using alloca(3) [PR116547]
authorWHR <whr@rivoreo.one>
Sat, 31 Aug 2024 06:26:02 +0000 (06:26 +0000)
committerThomas Schwinge <tschwinge@baylibre.com>
Fri, 3 Jul 2026 14:29:02 +0000 (16:29 +0200)
As GCC now treating implicit declaration of function as an error instead of
warning, compilation of libssp has been broken on some operating systems.
The following error is from an x86_64-unknown-freebsd11 system:

    [...]/libssp/ssp.c: In function 'fail':
    [...]/libssp/ssp.c:134:17: error: implicit declaration of function 'alloca' [-Wimplicit-function-declaration]
      134 |       p = buf = alloca (len);
          |                 ^~~~~~

Similarly: amd64-unknown-openbsd7.9.

Most operating systems specifies that 'stdlib.h' should be included to get
the declaration of alloca(3).

PR other/116547
* ssp.c: Include stdlib.h for alloca(3).

Co-authored-by: Thomas Schwinge <tschwinge@baylibre.com>
libssp/ssp.c

index 47abdf4e13d6493ce2c08552ea770e51a298adcf..04c13e46cd707b2e64d7ba30d9b7804969f6703c 100644 (file)
@@ -39,6 +39,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #ifdef HAVE_MALLOC_H
 # include <malloc.h>
 #endif
+#ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
 #ifdef HAVE_STRING_H
 # include <string.h>
 #endif