<div dir="ltr">Clang should only be doing this to internal symbols (or it should be making the symbol internal so it can perform such an optimization). Do you have a standalone (at least complete, ideally minimal) example of this issue?</div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Feb 24, 2014 at 8:58 AM, Gael Guennebaud <span dir="ltr"><<a href="mailto:gael.guennebaud@gmail.com" target="_blank">gael.guennebaud@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I've observed that clang changes the ABI when a function argument is not used.<br>
<br>
This is a nice optimization, but the downside is that this introduces<br>
segfaults when an argument is conditionally used with respect to<br>
compilation options (e.g., -DNDEBUG) and that both the application and<br>
a library instantiate this function, but only one is compiled with<br>
-DNDEBUG.<br>
<br>
Here is an example of how could look like such a function:<br>
<br>
template<int A, typename T><br>
void foo(int a, T &t) {<br>
  assert(A!=0 || a==0);<br>
  if(A==0) { /* code making use of both a and t */ }<br>
  else { /* code making use of t and A only */ }<br>
}<br>
<br>
and you can see a real-world example with a very ugly workaround there:<br>
<br>
<a href="https://bitbucket.org/eigen/eigen/commits/1e19a9cb83f0/" target="_blank">https://bitbucket.org/eigen/eigen/commits/1e19a9cb83f0/</a><br>
<br>
Does clang proposes a cleaner and more general workaround for such an issue?<br>
<br>
Thanks,<br>
<br>
Gael<br>
_______________________________________________<br>
cfe-users mailing list<br>
<a href="mailto:cfe-users@cs.uiuc.edu">cfe-users@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-users" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-users</a><br>
</blockquote></div><br></div>