GCC Newspaper
JULY 29, 2026
Date
/
Architectures
Components
Topics
News & Policy
libssp

libssp: Include stdlib.h for using alloca(3)

Includes stdlib.h in libssp to declare alloca(3), resolving compilation errors on systems that forbid implicit declarations.

GCC’s stricter error checking now flags implicit declarations of alloca as an error, breaking compilation for libssp on some systems. This patch includes stdlib.h, which provides the necessary declaration for alloca(3), resolving the issue and allowing libssp to compile correctly. This change was prompted by compilation failures on FreeBSD and OpenBSD systems.

In Details

The libstdc++ library's ssp.c file uses alloca without an explicit include of <stdlib.h>. With recent GCC versions treating implicit function declarations as errors (rather than warnings), compilation fails on systems like FreeBSD and OpenBSD. This commit adds the missing include to fix the build.

For Context
libssp
The library that implements the Stack Smashing Protection feature, which aims to detect and mitigate buffer overflows on the stack.
alloca
A function that allocates memory on the stack. The allocated memory is automatically freed when the calling function returns.
implicit declaration
When a function is called without its declaration (prototype) being seen by the compiler first. Older C standards allowed this, often with a default return type of 'int', but modern C and C++ standards generally treat it as an error.
stdlib.h
The C standard library header that provides general utility functions, including memory allocation (malloc, calloc, realloc, free) and alloca.
Filed Under: libsspbuilderror handling