[Bug libgomp/90527] alloc.c:72:7: error: implicit declaration of function ‘posix_memalign’
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat May 18 08:11:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90527
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
libgomp configure checks for posix_memalign:
AC_CHECK_FUNCS(aligned_alloc posix_memalign memalign _aligned_malloc)
and uses posix_memalign only if it is found:
#ifdef HAVE_ALIGNED_ALLOC
ret = aligned_alloc (al, size);
#elif defined(HAVE__ALIGNED_MALLOC)
ret = _aligned_malloc (size, al);
#elif defined(HAVE_POSIX_MEMALIGN)
if (posix_memalign (&ret, al, size) != 0)
ret = NULL;
#elif defined(HAVE_MEMALIGN)
{
extern void *memalign (size_t, size_t);
ret = memalign (al, size);
}
#else
So your case seems to be that posix_memalign is present in the library, but not
declared, I think AC_CHECK_FUNCS just checks whether it is defined in the
library. So, either we need additionally AC_CHECK_DECL for posix_memalign, or
for this case perhaps #define _GNU_SOURCE before first header in alloc.c might
be enough, in env.c we already do that.
So, can you try:
--- libgomp/alloc.c 2019-04-25 20:01:50.766232432 +0200
+++ libgomp/alloc.c 2019-05-18 10:10:40.153245345 +0200
@@ -27,6 +27,7 @@
places in the OpenMP API do not make any provision for failure, so in
general we cannot allow memory allocation to fail. */
+#define _GNU_SOURCE
#include "libgomp.h"
#include <stdlib.h>
More information about the Gcc-bugs
mailing list