PATCH to add a testcase (PR tree-optimization/83482)

Message ID 20171219110117.GN2605@redhat.com
State New
Headers show
Series
  • PATCH to add a testcase (PR tree-optimization/83482)
Related show

Commit Message

Marek Polacek Dec. 19, 2017, 11:01 a.m.
This PR was a dup of PR82264, but the testcases differ, because this one
crashes with -O2, and it's C++.

Tested on x86_64-linux, ok for trunk?

2017-12-19  Marek Polacek  <polacek@redhat.com>

	PR tree-optimization/83482
	* g++.dg/torture/pr83482.C: New test.


	Marek

Comments

Jakub Jelinek Dec. 19, 2017, 11:05 a.m. | #1
On Tue, Dec 19, 2017 at 12:01:17PM +0100, Marek Polacek wrote:
> This PR was a dup of PR82264, but the testcases differ, because this one

> crashes with -O2, and it's C++.

> 

> Tested on x86_64-linux, ok for trunk?

> 

> 2017-12-19  Marek Polacek  <polacek@redhat.com>

> 

> 	PR tree-optimization/83482

> 	* g++.dg/torture/pr83482.C: New test.

> 

> --- gcc/testsuite/g++.dg/torture/pr83482.C

> +++ gcc/testsuite/g++.dg/torture/pr83482.C

> @@ -0,0 +1,18 @@

> +// PR tree-optimization/83482

> +// { dg-do compile }

> +

> +void _setjmp(int);


Can you declare _setjmp to something closer to what is actually used?
Say
int _setjmp (void **);
and pass it a global void *buf[64]; or similar (if it still reproduces)?

> +void a();

> +class b {

> +public:


Perhaps just struct b {
instead?

> +  virtual long c() { return 0L; }

> +  void m_fn2() { c(); }

> +} d;

> +void e() {

> +  d.m_fn2();

> +  try {

> +    a();

> +    _setjmp(0);

> +  } catch (...) {

> +  }

> +}


Ok with those changes.

	Jakub

Patch

--- gcc/testsuite/g++.dg/torture/pr83482.C
+++ gcc/testsuite/g++.dg/torture/pr83482.C
@@ -0,0 +1,18 @@ 
+// PR tree-optimization/83482
+// { dg-do compile }
+
+void _setjmp(int);
+void a();
+class b {
+public:
+  virtual long c() { return 0L; }
+  void m_fn2() { c(); }
+} d;
+void e() {
+  d.m_fn2();
+  try {
+    a();
+    _setjmp(0);
+  } catch (...) {
+  }
+}