<div dir="ltr"><div class="gmail_extra">See:</div><div class="gmail_extra"><br></div><div class="gmail_extra">  <a href="http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-June/050886.html">http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-June/050886.html</a><br>
<br>... where this exact testcase was last discussed.<br><br><div class="gmail_quote">On Fri, Apr 4, 2014 at 9:39 AM, suyog sarda <span dir="ltr"><<a href="mailto:sardask01@gmail.com" target="_blank">sardask01@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Gentle Ping !! Please help to verify if this is a bug and if my analysis is correct.<br>
</div><div class=""><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Apr 1, 2014 at 10:18 PM, suyog sarda <span dir="ltr"><<a href="mailto:sardask01@gmail.com" target="_blank">sardask01@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>Hi all,<br><br></div><div>This is a test g++ test case for checking correct exception handling.<br>

<br></div><div><i>#ifdef __GXX_EXPERIMENTAL_CXX0X__<br>#define NOEXCEPT_FALSE noexcept (false)<br>#else<br>
#define NOEXCEPT_FALSE<br>#endif<br><br>extern "C" void abort ();<br> <br>int thrown;<br><br>int as;<br>struct a {<br>  a () { ++as; }<br>  ~a () NOEXCEPT_FALSE { --as; if (thrown++ == 0) throw 42; }<br>};<br> <br>


int f (a const&) { return 1; }<br>int f (a const&, a const&) { return 1; }<br><br>int bs;<br>int as_sav;<br>struct b {<br>  b (...) { ++bs; }<br>  ~b ()   { --bs; as_sav = as; }<br>};<br><br>bool p;<br>void g()<br>


{<br>  if (p) throw 42;<br>}<br><br>int main () {<br>  thrown = 0;<br>  try {<br>    b tmp(f (a(), a()));<br><br>    g();<br>  }  <br>  catch (...) {}<br><br>  // We throw when the first a is destroyed, which should destroy b before<br>


  // the other a.<br>  if (as_sav != 1)<br>    abort ();<br><br>  thrown = 0;<br>  try {<br>    b tmp(f (a()));<br><br>    g();<br>  }  <br>  catch (...) {}<br> <br>  if (bs != 0)<br>    abort ();<br>} </i><br clear="all">


</div><div><br></div><div>This Test Case aborts on ARM as well as X86 with clang latest trunk while with g++ no aborts are seen .<br><br></div><div>Here, when first temporary object '<i>a'</i> gets destroyed, its destructor is called where we throw an exception. This should immediately call destructor of <i>'b'</i> and before calling constructor of second temporary object <i>'a'</i>. Instead, with clang, it is waiting for second temporary object <i>'a'</i> to get destroyed and then calling its own destructor.<br>


<br></div><div>In my opinion, the compiler is not generating correct landing pad for the exception. Can someone please help in validating this reason? If it is a genuine bug then i will file a bug and try to work out solution for it. <br>


</div><div><br>--  <br>With regards,<br>Suyog Sarda<br></div>
</div>
</blockquote></div><br><br clear="all"><br>-- <br>With regards,<br>Suyog Sarda<br>
</div>
</div></div><br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div></div>