Version: 1.6.9
Steps to reproduce the bug:
Run the following commands:
CFLAGS='-DNDEBUG' ./configure
make
When compiling testapp.c, the error of undefined reference to `cache_error' would happen.
Path that fixes the bug:
@@ -1,5 +1,8 @@
/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
+#ifdef NDEBUG
#undef NDEBUG
+#define PRODUCT_BUILT_WITH_NDEBUG
+#endif
#include <pthread.h>
#include <sys/types.h>
#include <sys/socket.h>
@@ -236,12 +239,16 @@
char old = *(p - 1);
*(p - 1) = 0;
cache_free(cache, p);
+ #ifndef PRODUCT_BUILT_WITH_NDEBUG
assert(cache_error == -1);
+ #endif
*(p - 1) = old;
p[sizeof(uint32_t)] = 0;
cache_free(cache, p);
+ #ifndef PRODUCT_BUILT_WITH_NDEBUG
assert(cache_error == 1);
+ #endif
/* restore signal handler */
sigaction(SIGABRT, &old_action, NULL);