Hello,
I have segmentation fault while trying to execute a binary that uses MySQL C API. An error occurs every time mysql_select_db() is called. The output says:
Code:
in free(): error: free_pages: pointer to wrong page
Abort trap (core dumped)
After hours of debugging, i've discovered that
-O compiler flag causes that error to come. If compiled without
-O flag - everything works like a charm. e.g. (compiler options from Makefile):
Code:
COPT=-I /usr/local/include/mysql -L /usr/local/lib/mysql -O
Binary crashes with segfault
Code:
COPT=-I /usr/local/include/mysql -L /usr/local/lib/mysql
Binary works fine
I am not sure whether the problem is caused by MySQL C API bug or error in cc (or maybe error in programmer
)
The OS is OpenBSD 4.2 GENERIC.MP amd64
Thank you for suggestions.
Regards.