Add two test-cases for (PR middle-end/82404).
authorMartin Liska <mliska@suse.cz>
Wed, 20 Dec 2017 08:50:56 +0000 (09:50 +0100)
committerMartin Liska <marxin@gcc.gnu.org>
Wed, 20 Dec 2017 08:50:56 +0000 (08:50 +0000)
2017-12-20  Martin Liska  <mliska@suse.cz>

PR middle-end/82404
* g++.dg/pr82404.C: New test.
* gcc.dg/pr82404.c: New test.

From-SVN: r255851

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/pr82404.C [new file with mode: 0644]
gcc/testsuite/gcc.dg/pr82404.c [new file with mode: 0644]

index aaa8c0551fe1e593ee846be2db231934bd38533f..50bd37b31662e33ff42dd70dbe71fb9feca85c6e 100644 (file)
@@ -1,3 +1,9 @@
+2017-12-20  Martin Liska  <mliska@suse.cz>
+
+       PR middle-end/82404
+       * g++.dg/pr82404.C: New test.
+       * gcc.dg/pr82404.c: New test.
+
 2017-12-20  Julia Koval  <julia.koval@intel.com>
 
        * gcc.target/i386/avx-1.c: Handle new intrinsics.
diff --git a/gcc/testsuite/g++.dg/pr82404.C b/gcc/testsuite/g++.dg/pr82404.C
new file mode 100644 (file)
index 0000000..9d86071
--- /dev/null
@@ -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 (file)
index 0000000..53565d3
--- /dev/null
@@ -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 } }