]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
testsuite: Add testcase for already fixed PR [PR100469]
authorJakub Jelinek <jakub@redhat.com>
Mon, 15 Nov 2021 13:47:44 +0000 (14:47 +0100)
committerJakub Jelinek <jakub@redhat.com>
Mon, 15 Nov 2021 13:47:44 +0000 (14:47 +0100)
This bug introduced in r11-7448-gff92ede8d269375f800e1b347a48f4698874b4a3
has been fixed already by r12-1354-g2d2ed777b23ab6503027039e0adbfe1162f52b2f
aka PR100852 fix.

2021-11-15  Jakub Jelinek  <jakub@redhat.com>

PR debug/100469
* g++.dg/opt/pr100469.C: New test.

gcc/testsuite/g++.dg/opt/pr100469.C [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.dg/opt/pr100469.C b/gcc/testsuite/g++.dg/opt/pr100469.C
new file mode 100644 (file)
index 0000000..9eb37e7
--- /dev/null
@@ -0,0 +1,32 @@
+// PR debug/100469
+// { dg-do compile }
+// { dg-options "-O2 -fcompare-debug -fno-tree-dse -fno-tree-forwprop -fno-tree-tail-merge --param=sccvn-max-alias-queries-per-access=0" }
+
+struct S
+{
+  long m;
+  S (const S &s)
+  {
+    m = s.m;
+  }
+  S (long l)
+  {
+    m = l;
+  }
+  bool operatorX (const S &s)
+  {
+    return m >= s.m;
+  }
+};
+
+static inline S
+bar (S a, S b)
+{
+  return a.operatorX (b) ? a : b;
+}
+
+S
+foo (S s)
+{
+  return bar (s, (S) 0);
+}