Yes the testcase attached in the PR works for me but I can't change the
status because I am not the reporter (nor admin).

I will close it.

However, the testcase I have added g++.dg/tm/ctor-used.C fails. I can
fill another PR but I found this problem thanks to the PR testcase.

If you mean the following test, there is no ICE here either with current sources. However, I do see that you expect something else to be generated.

If I compile it with optimization (-O1), there is no call to the runtime as expected (no _ITM_getTMCloneOrIrrevocable), we just inline the initialization to 0 inside the transaction. And we optimize away the constructor "C():l(0)".

If I compile with no optimization, there is a the call through the runtime (which according to your test you DONT expect, why?), and we generate code for C():l(0). This seems correct.

I don't see anything wrong with the generated code.

What are you expecting?

+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -fdump-tree-optimized" } */
+
+struct C {
+  long l;
+  C():l(0) {}
+};
+
+int main()
+{
+  C* alloc;
+  __transaction_atomic {
+    alloc = new C;
+  }
+  alloc->l = 2;
+
+  return 0;
+}
+/* { dg-final { scan-assembler-not "_ITM_getTMCloneOrIrrevocable" } } */
+/* { dg-final { scan-tree-dump-times ";; Function C::C" 1 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */

Reply via email to