<div dir="ltr">XFAIL'd for hexagon in r302825, filed PR33009 for the miscompile.<br><div><br></div><div>Looks like it's only passing empty structs in C++ that is miscompiled, but that's still pretty serious.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 11 May 2017 at 14:30, Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Wow, the Hexagon target is just horribly broken. Reduced testcase:<div><br></div><div>struct A { A(); A(const A&); ~A(); };</div><div>void f(A a);</div><div>void g() { f(A()); }</div><div><br></div><div>This completely fails to pass an A object to f. Instrumented version:</div><div><br></div><div><div>#include <stdio.h></div><div>#define DUMP(ptr) printf("%s %p\\n", __PRETTY_FUNCTION__, ptr)</div><div><br></div><div>struct A {</div><div>  A() { DUMP(this); }</div><div>  A(const A&) { DUMP(this); }</div><div>  ~A() { DUMP(this); }</div><div>};</div><div>void f(A a) { DUMP(&a); }</div><div>int main() { f(A()); }</div><div><br></div><div>... prints:</div><div><br></div><div>A::A() 0x7ffd54d95658<br></div><div class="gmail_extra"><div class="gmail_extra">void f(A) 0x7ffd54d95638</div><div class="gmail_extra">A::~A() 0x7ffd54d95658</div><div><br></div><div>Also, the hexagon bot appears to be failing to send mail.</div><div><div class="h5"><div><br></div><div class="gmail_quote">On 11 May 2017 at 13:17, Krzysztof Parzyszek via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</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">Hexagon is still broken.  :(<br>
<br>
<a href="http://lab.llvm.org:8011/builders/clang-hexagon-elf/builds/7942" rel="noreferrer" target="_blank">http://lab.llvm.org:8011/build<wbr>ers/clang-hexagon-elf/builds/7<wbr>942</a><br>
<br>
-Krzysztof<div class="m_-8252841858417965278gmail-HOEnZb"><div class="m_-8252841858417965278gmail-h5"><br>
<br>
On 5/11/2017 1:58 PM, Richard Smith via cfe-commits wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Author: rsmith<br>
Date: Thu May 11 13:58:24 2017<br>
New Revision: 302817<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=302817&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject?rev=302817&view=rev</a><br>
Log:<br>
PR22877: When constructing an array via a constructor with a default argument<br>
in list-initialization, run cleanups for the default argument after each<br>
iteration of the initialization loop.<br>
<br>
We previously only ran the destructor for any temporary once, at the end of the<br>
complete loop, rather than once per iteration!<br>
<br>
Re-commit of r302750, reverted in r302776.<br>
<br>
Added:<br>
     cfe/trunk/test/CodeGenCXX/arr<wbr>ay-default-argument.cpp<br>
       - copied, changed from r302775, cfe/trunk/test/CodeGenCXX/arra<wbr>y-default-argument.cpp<br>
Modified:<br>
     cfe/trunk/lib/CodeGen/CGExprA<wbr>gg.cpp<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGExprAg<wbr>g.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=302817&r1=302816&r2=302817&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/lib/CodeGen/CG<wbr>ExprAgg.cpp?rev=302817&r1=3028<wbr>16&r2=302817&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/CodeGen/CGExprAg<wbr>g.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CGExprAg<wbr>g.cpp Thu May 11 13:58:24 2017<br>
@@ -512,12 +512,20 @@ void AggExprEmitter::EmitArrayInit(<wbr>Addre<br>
      currentElement->addIncoming(el<wbr>ement, entryBB);<br>
        // Emit the actual filler expression.<br>
-    LValue elementLV =<br>
-      CGF.MakeAddrLValue(Address(cur<wbr>rentElement, elementAlign), elementType);<br>
-    if (filler)<br>
-      EmitInitializationToLValue(fil<wbr>ler, elementLV);<br>
-    else<br>
-      EmitNullInitializationToLValue<wbr>(elementLV);<br>
+    {<br>
+      // C++1z [class.temporary]p5:<br>
+      //   when a default constructor is called to initialize an element of<br>
+      //   an array with no corresponding initializer [...] the destruction of<br>
+      //   every temporary created in a default argument is sequenced before<br>
+      //   the construction of the next array element, if any<br>
+      CodeGenFunction::RunCleanupsSc<wbr>ope CleanupsScope(CGF);<br>
+      LValue elementLV =<br>
+        CGF.MakeAddrLValue(Address(cur<wbr>rentElement, elementAlign), elementType);<br>
+      if (filler)<br>
+        EmitInitializationToLValue(fil<wbr>ler, elementLV);<br>
+      else<br>
+        EmitNullInitializationToLValue<wbr>(elementLV);<br>
+    }<br>
        // Move on to the next element.<br>
      llvm::Value *nextElement =<br>
<br>
Copied: cfe/trunk/test/CodeGenCXX/arra<wbr>y-default-argument.cpp (from r302775, cfe/trunk/test/CodeGenCXX/arra<wbr>y-default-argument.cpp)<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/array-default-argument.cpp?p2=cfe/trunk/test/CodeGenCXX/array-default-argument.cpp&p1=cfe/trunk/test/CodeGenCXX/array-default-argument.cpp&r1=302775&r2=302817&rev=302817&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/test/CodeGenCX<wbr>X/array-default-argument.cpp?p<wbr>2=cfe/trunk/test/CodeGenCXX/ar<wbr>ray-default-argument.cpp&p1=cf<wbr>e/trunk/test/CodeGenCXX/array-<wbr>default-argument.cpp&r1=302775<wbr>&r2=302817&rev=302817&view=<wbr>diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/CodeGenCXX/arra<wbr>y-default-argument.cpp (original)<br>
+++ cfe/trunk/test/CodeGenCXX/arra<wbr>y-default-argument.cpp Thu May 11 13:58:24 2017<br>
@@ -17,11 +17,11 @@ void g() {<br>
    // CHECK: br label %[[LOOP:.*]]<br>
      // [[LOOP]]:<br>
-  // CHECK: {{call|invoke}}[[THISCALL:( x86_thiscallcc)?]] void @_ZN1AC1Ev([[TEMPORARY:.*]])<br>
+  // CHECK: {{call|invoke}} {{.*}} @_ZN1AC1Ev([[TEMPORARY:.*]])<br>
    // CHECK-EH:  unwind label %[[PARTIAL_ARRAY_LPAD:.*]]<br>
-  // CHECK: {{call|invoke}}[[THISCALL]] void @_ZN1BC1E1A({{.*}}, [[TEMPORARY]])<br>
+  // CHECK: {{call|invoke}} {{.*}} @_ZN1BC1E1A({{.*}}, [[TEMPORARY]])<br>
    // CHECK-EH:  unwind label %[[A_AND_PARTIAL_ARRAY_LPAD:.*<wbr>]]<br>
-  // CHECK: {{call|invoke}}[[THISCALL]] void @_ZN1AD1Ev([[TEMPORARY]])<br>
+  // CHECK: {{call|invoke}} {{.*}} @_ZN1AD1Ev([[TEMPORARY]])<br>
    // CHECK-EH:  unwind label %[[PARTIAL_ARRAY_LPAD]]<br>
    // CHECK: getelementptr {{.*}}, i{{[0-9]*}} 1<br>
    // CHECK: icmp eq<br>
@@ -32,5 +32,5 @@ void g() {<br>
    f();<br>
      // CHECK-NOT: @_ZN1AD1Ev(<br>
-  // CHECK: {{call|invoke}}[[THISCALL]] void @_ZN1BD1Ev(<br>
+  // CHECK: {{call|invoke}} {{.*}} @_ZN1BD1Ev(<br>
  }<br>
<br>
<br>
______________________________<wbr>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-commits</a><br>
<br>
</blockquote>
<br></div></div><span class="m_-8252841858417965278gmail-HOEnZb"><font color="#888888">
-- <br>
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation</font></span><div class="m_-8252841858417965278gmail-HOEnZb"><div class="m_-8252841858417965278gmail-h5"><br>
______________________________<wbr>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-commits</a><br>
</div></div></blockquote></div><br></div></div></div></div></div>
</blockquote></div><br></div>