<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><font face="Calibri" style="font-size: 14px;" class="">Dear All,</font></div><div class=""><font face="Calibri" style="font-size: 14px;" class=""><br class=""></font></div><div class=""><font face="Calibri" class=""><span style="font-size: 14px;" class="">I wrote a program and it compiled by Clang 3.4 with its undefined behavior sanitizer. However, the sanitizer warned it as follows that a type-mismatched function call was made in the code even though the type looked to be the same as my original intention. </span></font><span style="font-family: Calibri; font-size: 14px;" class="">I would appreciate if someone could give me an explanation about the reason behind the warning (the warning actually is a runtime error though).</span></div><div class=""><span style="font-size: 14px; font-family: Calibri;" class=""><br class=""></span></div><div class=""><font face="Calibri" class=""><span style="font-size: 14px;" class="">==11410==WARNING: Trying to symbolize code, but external symbolizer is not initialized!</span></font><div class=""><font face="Calibri" class=""><span style="font-size: 14px;" class="">path</span></font><span style="font-size: 14px; font-family: Calibri;" class="">/</span><span style="font-size: 14px; font-family: Calibri;" class="">to</span><span style="font-size: 14px; font-family: Calibri;" class="">/</span><span style="font-size: 14px; font-family: Calibri;" class="">HelloWorld</span><span style="font-size: 14px; font-family: Calibri;" class="">.</span><span style="font-size: 14px; font-family: Calibri;" class="">cpp</span><span style="font-size: 14px; font-family: Calibri;" class="">:</span><span style="font-size: 14px; font-family: Calibri;" class="">25</span><span style="font-size: 14px; font-family: Calibri;" class="">:</span><span style="font-size: 14px; font-family: Calibri;" class="">13</span><span style="font-size: 14px; font-family: Calibri;" class="">:</span><span style="font-size: 14px; font-family: Calibri;" class=""> runtime error</span><span style="font-size: 14px; font-family: Calibri;" class="">:</span><span style="font-size: 14px; font-family: Calibri;" class=""> call to function </span><span style="font-size: 14px; font-family: Calibri;" class="">(</span><span style="font-size: 14px; font-family: Calibri;" class="">unknown</span><span style="font-size: 14px; font-family: Calibri;" class="">)</span><span style="font-size: 14px; font-family: Calibri;" class=""> through pointer to incorrect function type </span><span style="font-size: 14px; font-family: Calibri;" class="">'foo::CBar &(*)()'</span></div><font face="Calibri" class=""><span style="font-size: 14px;" class="">(./libFoo.so+0x20af0): note: (unknown) defined here</span></font></div><div class=""><br class=""></div><div class=""><font face="Calibri" style="font-size: 14px;" class="">I have confirmed some facts of the target function, which triggers the issue, are summarized as follows:</font></div><div class=""><font face="Calibri" style="font-size: 14px;" class=""><br class=""></font></div><div class=""><font face="Calibri" style="font-size: 14px;" class="">* </font><span style="font-family: Calibri; font-size: 14px;" class="">The target function i</span><font face="Calibri" style="font-size: 14px;" class="">s called through a function pointer, which is exported from another library / shared object.</font></div><div class=""><font face="Calibri" class=""><span style="font-size: 14px;" class="">* </span></font><span style="font-family: Calibri; font-size: 14px;" class="">The target function r</span><span style="font-size: 14px; font-family: Calibri;" class="">eturns a user-defined type (class or struct) or has a user-defined type as its argument.</span></div><div class=""><font face="Calibri" class=""><span style="font-size: 14px;" class="">* If the return value or the arguments are C++ standard library class such as std::string or std::vector, the issue doesn’t happen.</span></font></div><div class=""><font face="Calibri" style="font-size: 14px;" class=""><br class=""></font></div><div class=""><font face="Calibri" style="font-size: 14px;" class="">To review the source code in detail, please have a look at the following </font><font face="Calibri" class=""><span style="font-size: 14px;" class="">stackoverflow page. I will provide you the source files if it’s not good to introduce a URL reference on the mailing list.</span></font></div><div class=""><font face="Calibri" style="font-size: 14px;" class=""><br class=""></font></div><div class=""><font face="Calibri" class=""><span style="font-size: 14px;" class="">Clang's UBSan & Function Pointer: Is this illegal?</span></font></div><div class=""><font face="Calibri" style="font-size: 14px;" class=""><a href="http://stackoverflow.com/questions/27976687/clangs-ubsan-function-pointer-is-this-illegal" class="">http://stackoverflow.com/questions/27976687/clangs-ubsan-function-pointer-is-this-illegal</a></font></div><div class=""><font face="Calibri" style="font-size: 14px;" class=""><br class=""></font></div><div class=""><font face="Calibri" style="font-size: 14px;" class="">Best regards,</font></div><div class=""><font face="Calibri" style="font-size: 14px;" class="">Kazunari</font></div><div class=""><br class=""></div></body></html>