https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61407

--- Comment #38 from Lawrence Velázquez <larryv at macports dot org> ---
Created attachment 33464
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33464&action=edit
Corrected dirent patch

Couple of things:

1) The version of Sanitizer included with GCC 4.9.1 at least, and probably
earlier, has the includes in the wrong order in
sanitizer_platform_limits_posix.cc:

  #include "sanitizer_platform.h"
  #if SANITIZER_LINUX || SANITIZER_MAC

  #include "sanitizer_internal_defs.h"
  #include "sanitizer_platform_limits_posix.h"

  #include <arpa/inet.h>
  #include <dirent.h>

Since sanitizer_platform_limits_posix.h is included before the system headers,
_DARWIN_FEATURE_64_BIT_INODE is *not* defined for the second hunk of your
patch, and the 32-bit dirent is always used. However, it *is* defined for the
first hunk, so CHECK_SIZE_AND_OFFSET does try to access d_seekoff (and
predictably fails).

The ordering is fixed in Sanitizer upstream, but it's more robust to directly
include sys/cdefs.h in sanitizer_platform_limits_posix.h to avoid relying on
include ordering.

2) You should report this bug upstream.

  http://compiler-rt.llvm.org

Reply via email to