<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" id="owaParaStyle">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body fpstyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Thanks Kevin,<br>
<br>
I submitted bssm again to CRAN and claimed that the issue is with clang 4.0.0, but CRAN just updated to clang 4.0.1 and the issue remains (and there is also a new issue...).<br>
<br>
But, while implementing new stuff which also use Xptr, I realized that I can somewhat streamline my previous codes, which I hope might result warning free code by accident. ;)<br>
<br>
Best,<br>
<br>
Jouni<br>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div id="divRpF969197" style="direction: ltr;"><font color="#000000" size="2" face="Tahoma"><b>Lähettäjä:</b> Kevin Ushey [kevinushey@gmail.com]<br>
<b>Lähetetty:</b> 9. heinäkuuta 2017 2:33<br>
<b>Vastaanottaja:</b> Helske, Jouni<br>
<b>Kopio:</b> rcpp-devel@r-forge.wu-wien.ac.at<br>
<b>Aihe:</b> Re: [Rcpp-devel] Call to function through pointer to incorrect function type on UBSAN<br>
</font><br>
</div>
<div></div>
<div>
<div dir="ltr">
<div>I can't replicate the reported UBSAN issues on my macOS machine (R-devel compiled with LLVM clang 4.0.1, with address + undefined behavior sanitizers active).</div>
<div><br>
</div>
<div>The warnings look somewhat dubious to me: for example, the first warning:</div>
<div>
<pre style="color:rgb(0,0,0); word-wrap:break-word; white-space:pre-wrap">function_pointers.h:99:12: runtime error: call to function a1_fn(arma::Col<double> const&, arma::Col<double> const&) through pointer to incorrect function type 'arma::Col<double> (*)(const arma::Col<double> &, const arma::Col<double> &)'
/tmp/RtmpObvRHm/sourceCpp-x86_64-pc-linux-gnu-0.12.11/sourcecpp_96075e756157/growth_model_functions.cpp:7: note: a1_fn(arma::Col<double> const&, arma::Col<double> const&) defined here
</pre>
</div>
<div>If I'm reading that correctly, you have the following types:</div>
<div>
<blockquote style="margin:0px 0px 0px 40px; border:none; padding:0px">
<div>
<pre style="color:rgb(0,0,0); word-wrap:break-word; white-space:pre-wrap">Pointer:                      (arma::Col<double> const&,  arma::Col<double> const& )
Actual:  arma::Col<double> (*)(const arma::Col<double> &, const arma::Col<double> &)
</pre>
</div>
</blockquote>
</div>
<div>
<div class="gmail_extra">and those look compatible to me (the only difference is the ordering of the 'const &' printing in each case).</div>
<div class="gmail_extra"><br>
</div>
<div class="gmail_extra">Unless I'm missing something obvious, it seems like this might just be a bug in the version of UBSAN used on the CRAN build machines? The fact that this error is not seen with gcc, only with clang, supports that hypothesis, so I think
 you can safely ignore those errors. (Perhaps this was a bug in Clang 4.0.0 that was fixed in Clang 4.0.1)</div>
<div class="gmail_extra"><br>
</div>
<div class="gmail_extra">Kevin</div>
<div class="gmail_extra"><br>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Fri, Jul 7, 2017 at 2:58 PM, Helske, Jouni <span dir="ltr">
<<a href="mailto:jouni.helske@jyu.fi" target="_blank">jouni.helske@jyu.fi</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div>
<div style="direction:ltr; font-family:Tahoma; color:rgb(0,0,0); font-size:10pt">
I got some warnings on CRAN with UBSAN relating to my use of user supplied C++ function using Xptr:
<a href="https://www.stats.ox.ac.uk/pub/bdr/memtests/clang-UBSAN/bssm/build_vignettes.log" target="_blank">
https://www.stats.ox.ac.uk/<wbr>pub/bdr/memtests/clang-UBSAN/<wbr>bssm/build_vignettes.log</a>
<br>
<br>
I can't see anything wrong in my codes, although I have just tried to mimic some Dirk's Xptr examples without fully understanding what is going on, so maybe I actually do something silly. But I then noticed that Rcpp also has similar kind of warnings (<a href="https://www.stats.ox.ac.uk/pub/bdr/memtests/clang-UBSAN/Rcpp/build_vignettes.log" target="_blank">https://www.stats.ox.ac.uk/<wbr>pub/bdr/memtests/clang-UBSAN/<wbr>Rcpp/build_vignettes.log</a>),
 so I wonder if these are anything to worry about? I tested my package on GCC based address sanitizer using docker, and did not get any warnings with that setup, which makes me think that maybe it's just some clang issue? Some googling seems to support this
 theory: <a href="https://stackoverflow.com/questions/43220926/call-to-function-unknown-through-pointer-to-incorrect-function-type" target="_blank">
https://stackoverflow.com/<wbr>questions/43220926/call-to-<wbr>function-unknown-through-<wbr>pointer-to-incorrect-function-<wbr>type</a><br>
<br>
Best,<br>
<br>
Jouni<br>
<br>
<br>
<br>
</div>
</div>
<br>
______________________________<wbr>_________________<br>
Rcpp-devel mailing list<br>
<a href="mailto:Rcpp-devel@lists.r-forge.r-project.org" target="_blank">Rcpp-devel@lists.r-forge.r-<wbr>project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" rel="noreferrer" target="_blank">https://lists.r-forge.r-<wbr>project.org/cgi-bin/mailman/<wbr>listinfo/rcpp-devel</a><br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>