Add two test-cases for (PR middle-end/82404).

Message ID ee041376-a6e0-788e-598c-492647e654c2@suse.cz
State New
Headers show
Series
  • Add two test-cases for (PR middle-end/82404).
Related show

Commit Message

Martin Liška Dec. 19, 2017, 10:16 a.m.
Hello.

Following patch adds two test-cases for the PR.

Ready for trunk?
Martin

gcc/testsuite/ChangeLog:

2017-12-19  Martin Liska  <mliska@suse.cz>

	PR middle-end/82404
	* g++.dg/pr82404.C: New test.
	* gcc.dg/pr82404.c: New test.
---
 gcc/testsuite/g++.dg/pr82404.C | 17 +++++++++++++++++
 gcc/testsuite/gcc.dg/pr82404.c | 17 +++++++++++++++++
 2 files changed, 34 insertions(+)
 create mode 100644 gcc/testsuite/g++.dg/pr82404.C
 create mode 100644 gcc/testsuite/gcc.dg/pr82404.c

Comments

Jeff Law Dec. 19, 2017, 4:24 p.m. | #1
On 12/19/2017 03:16 AM, Martin Liška wrote:
> Hello.

> 

> Following patch adds two test-cases for the PR.

> 

> Ready for trunk?

> Martin

> 

> gcc/testsuite/ChangeLog:

> 

> 2017-12-19  Martin Liska  <mliska@suse.cz>

> 

> 	PR middle-end/82404

> 	* g++.dg/pr82404.C: New test.

> 	* gcc.dg/pr82404.c: New test.

OK.
jeff

Patch

diff --git a/gcc/testsuite/g++.dg/pr82404.C b/gcc/testsuite/g++.dg/pr82404.C
new file mode 100644
index 00000000000..9d860714865
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr82404.C
@@ -0,0 +1,17 @@ 
+// PR middle-end/82404
+
+// { dg-do compile }
+// { dg-options "-O3 -Wall -fdump-tree-optimized -Wno-return-type" } 
+
+enum eShape { eSquare, eCircle, eShpere, eTetraeder };
+
+double test_switch_native(enum eShape shape, double r) {
+    switch(shape) {
+    case eSquare:    return 2;
+    case eCircle:    return 3;
+    case eShpere:    return 4;
+    case eTetraeder: return 5;
+    }
+}
+
+// { dg-final { scan-tree-dump-not "if "  optimized } }
diff --git a/gcc/testsuite/gcc.dg/pr82404.c b/gcc/testsuite/gcc.dg/pr82404.c
new file mode 100644
index 00000000000..53565d310f5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr82404.c
@@ -0,0 +1,17 @@ 
+// PR middle-end/82404
+
+// { dg-do compile }
+// { dg-options "-O3 -Wall -fdump-tree-optimized -Wno-return-type" } 
+
+enum eShape { eSquare, eCircle, eShpere, eTetraeder };
+
+double test_switch_native(enum eShape shape, double r) {
+    switch(shape) {
+    case eSquare:    return 2;
+    case eCircle:    return 3;
+    case eShpere:    return 4;
+    case eTetraeder: return 5;
+    }
+}
+
+// { dg-final { scan-tree-dump-times "if " 1 optimized } }