public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-2092] Add test for [PR55881].
@ 2021-07-06 21:59 Martin Sebor
  0 siblings, 0 replies; only message in thread
From: Martin Sebor @ 2021-07-06 21:59 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:e8db5f70f27b6de8139339ef1866eaa153c2bf67

commit r12-2092-ge8db5f70f27b6de8139339ef1866eaa153c2bf67
Author: Martin Sebor <msebor@redhat.com>
Date:   Tue Jul 6 15:58:02 2021 -0600

    Add test for [PR55881].
    
            PR c++/55881
    
    gcc/testsuite/ChangeLog:
    
            * g++.dg/warn/uninit-pr55881.C: New test.

Diff:
---
 gcc/testsuite/g++.dg/warn/uninit-pr55881.C | 34 ++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/gcc/testsuite/g++.dg/warn/uninit-pr55881.C b/gcc/testsuite/g++.dg/warn/uninit-pr55881.C
new file mode 100644
index 00000000000..b01f4e78105
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/uninit-pr55881.C
@@ -0,0 +1,34 @@
+/* PR middle-end/55881 - #pragma GCC diagnostic ignored ignored when inlining
+   { dg-do compile }
+   { dg-options "-O2 -Wall" } */
+
+struct I
+{
+  int i;
+  int foo (struct I *n)
+  {
+    return n->i + 10;         // { dg-bogus "-Wmaybe-uninitialized" }
+  }
+
+  I () : i (5) {}
+};
+
+int main (int argc, char **)
+{
+  struct I i, *n;
+
+  if (argc > 10)
+    {
+      n = new I;
+      i.i = i.foo (n);
+  }
+
+  if (argc > 2)
+    {
+#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+      return i.foo (n);
+#pragma GCC diagnostic pop
+    }
+
+  return 0;
+}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-07-06 21:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-06 21:59 [gcc r12-2092] Add test for [PR55881] Martin Sebor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).