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

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

commit r12-2091-gee9a0e93156ff3d41450db74172abc8ae2471d1f
Author: Martin Sebor <msebor@redhat.com>
Date:   Tue Jul 6 15:15:53 2021 -0600

    Add test for [PR86650].
    
    PR tree-optimization/86650 - -Warray-bounds missing inlining context
    
    gcc/testsuite/ChangeLog:
            PR tree-optimization/86650
            * gcc.dg/Warray-bounds-76.c: New test.

Diff:
---
 gcc/testsuite/gcc.dg/Warray-bounds-76.c | 35 +++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-76.c b/gcc/testsuite/gcc.dg/Warray-bounds-76.c
new file mode 100644
index 00000000000..6711dc45f30
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-76.c
@@ -0,0 +1,35 @@
+/* PR tree-optimization/86650 - -Warray-bounds missing inlining context
+   { dg-do compile }
+   { dg-options "-O2 -Wall" } */
+
+static void f0 (int *p, int i)
+{
+  p[i] = 0;         // { dg-warning "\\\[-Warray-bounds" }
+}
+
+// Expect two instances of the text below:
+// { dg-regexp "In function 'f0'," "first f0 prefix" { target *-*-* } 0 }
+// { dg-regexp "In function 'f0'," "second f0 prefix" { target *-*-* } 0 }
+
+static void f1 (int *p, int i) { f0 (p + 1, i + 1); }
+static void f2 (int *p, int i) { f1 (p + 1, i + 1); }
+
+extern int a2[2];   // { dg-note "'a2'" }
+
+void foo (void)
+{
+  f1 (a2 + 1, 1);
+}
+
+// { dg-regexp " +inlined from 'foo' at \[^:\]+Warray-bounds-76.c:21:\\d+:" "inlined from foo" }
+
+extern int a3[3];   // { dg-note "'a3'" }
+
+void bar (void)
+{
+  f2 (a3 + 1, 1);
+}
+
+// { dg-regexp " +inlined from 'f1' at \[^:\]+Warray-bounds-76.c:14:\\d+," "inlined from f1" }
+// { dg-regexp " +inlined from 'f2' at \[^:\]+Warray-bounds-76.c:15:\\d+," "inlined from f2" }
+// { dg-regexp " +inlined from 'bar' at \[^:\]+Warray-bounds-76.c:30:\\d+:" "inlined from bar" }


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

only message in thread, other threads:[~2021-07-06 21:31 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:31 [gcc r12-2091] Add test for [PR86650] 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).