[LLVMdev] PATCH: AddressSanitizer: Fix errors about mis-matched exception specifiers for intercepted libc functions on Linux

Chandler Carruth chandlerc at google.com
Mon Jun 25 02:10:17 PDT 2012


Hello,

On modern Linux installs, glibc has a very annoying practice: it adds an
empty exception specifier to lots of libc functions as an optimization. It
only does this if the compiler is modern and GCC-like, and we are compiling
in C++ mode.

This, however, causes GCC to complain about signature mismatches between
the glibc functions declared in malloc.h and those defined as an alias in
the interceptors library:

..../asan_malloc_linux.cc:57:1: error: declaration of 'void free(void*)'
has a different exception specifier
/usr/include/malloc.h:66:13: error: from previous declaration 'void
free(void*) throw ()'


I've attached a complete hack of a patch to address this... but surely
there is a better way? I'm open to suggestions about this sticky issue.

Amusingly, this is only diagnosed by GCC, not by Clang. =] So I didn't even
notice it at first.
-Chandler
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120625/5e64b4dd/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: exception-spec.patch
Type: application/octet-stream
Size: 593 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120625/5e64b4dd/attachment.obj>


More information about the llvm-dev mailing list