Hello.
In transition to simple_case_node, I forgot to initialize m_high to m_low if a
case
does not have CASE_HIGH.
Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
Ready to be installed?
Martin
gcc/ChangeLog:
2017-09-11 Martin Liska <[email protected]>
PR middle-end/82154
* stmt.c (struct simple_case_node): Assign low to high when
high is equal to null.
gcc/testsuite/ChangeLog:
2017-09-11 Martin Liska <[email protected]>
PR middle-end/82154
* g++.dg/torture/pr82154.C: New test.
---
gcc/stmt.c | 3 +-
gcc/testsuite/g++.dg/torture/pr82154.C | 50 ++++++++++++++++++++++++++++++++++
2 files changed, 52 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/g++.dg/torture/pr82154.C
diff --git a/gcc/stmt.c b/gcc/stmt.c
index 39d29ff3da9..9b33657372f 100644
--- a/gcc/stmt.c
+++ b/gcc/stmt.c
@@ -71,7 +71,8 @@ along with GCC; see the file COPYING3. If not see
struct simple_case_node
{
simple_case_node (tree low, tree high, tree code_label):
- m_low (low), m_high (high), m_code_label (code_label)
+ m_low (low), m_high (high != NULL_TREE ? high : low),
+ m_code_label (code_label)
{}
/* Lowest index value for this label. */
diff --git a/gcc/testsuite/g++.dg/torture/pr82154.C b/gcc/testsuite/g++.dg/torture/pr82154.C
new file mode 100644
index 00000000000..f4e1c3ea139
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr82154.C
@@ -0,0 +1,50 @@
+// { dg-do compile }
+// { dg-additional-options "-Wno-deprecated" }
+
+namespace a {
+int b;
+class c
+{
+};
+}
+class g
+{
+public:
+ g ();
+};
+using a::b;
+class d
+{
+public:
+ d ();
+ void e ();
+};
+class f
+{
+ d
+ i ()
+ {
+ static d j;
+ }
+ int *k () throw (a::c);
+};
+
+
+int *f::k () throw (a::c)
+{
+ static g h;
+ i ();
+ int l = 2;
+ while (l)
+ {
+ --l;
+ try
+ {
+ operator new (b);
+ }
+ catch (a::c)
+ {
+ }
+ }
+ i ().e ();
+}