From f135a63c61dac46a246ac501e9d9e1d0b5776e60 Mon Sep 17 00:00:00 2001 From: Johanna Amann Date: Thu, 13 Oct 2016 13:26:43 -0700 Subject: [PATCH] Fix md5 problem with freebsd 11.0 clang 3.8 With clang on FreeBSD 11.0-p1, some md5 functions tend to return the wrong result. This is, e.g., visible when running the bifs/md5 testcase. In this test, the checks using md5_hash_finish will return an empty string. The apparent cause is some confusion in clang when using a static char inside a static inline function that is refered to several compilation units. Exact version of clang showing this issue is: FreeBSD clang version 3.8.0 (tags/RELEASE_380/final 262564) (based on LLVM 3.8.0) Target: x86_64-unknown-freebsd11.0 Thread model: posix InstalledDir: /usr/bin Issue occurs with -O2. The first person to either find an existing clang bugreport for this, or to create an minimal testcase and files one will get a drink from me :) --- src/digest.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/digest.h b/src/digest.h index ef52ba059a..a6057c53b2 100644 --- a/src/digest.h +++ b/src/digest.h @@ -12,7 +12,7 @@ #include "Reporter.h" -static inline const char* digest_print(const u_char* digest, size_t n) +inline const char* digest_print(const u_char* digest, size_t n) { static char buf[256]; // big enough for any of md5/sha1/sha256 for ( size_t i = 0; i < n; ++i )