public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-6862] Testcase for old PR 47059
@ 2021-01-22 17:11 Martin Jambor
  0 siblings, 0 replies; only message in thread
From: Martin Jambor @ 2021-01-22 17:11 UTC (permalink / raw)
  To: gcc-cvs

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

commit r11-6862-gd7e681fc3afff24a6279058cbb0b0dc4cd96be8c
Author: Martin Jambor <mjambor@suse.cz>
Date:   Fri Jan 22 18:09:38 2021 +0100

    Testcase for old PR 47059
    
    I stumbled across PR 47059 from 2010 which has been addressed by
    store-merging.  I am going to close it but would like to add its
    testcase too.
    
    gcc/testsuite/ChangeLog:
    
    2021-01-08  Martin Jambor  <mjambor@suse.cz>
    
            PR tree-optimization/47059
            * gcc.dg/tree-ssa/pr47059.c: New test.

Diff:
---
 gcc/testsuite/gcc.dg/tree-ssa/pr47059.c | 45 +++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr47059.c b/gcc/testsuite/gcc.dg/tree-ssa/pr47059.c
new file mode 100644
index 00000000000..9f9c61aa213
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr47059.c
@@ -0,0 +1,45 @@
+/* { dg-do compile } */
+/* { dg-options "-Os -fdump-tree-optimized" } */
+
+
+struct struct1
+{
+  void *data;
+  unsigned short f1;
+  unsigned short f2;
+};
+typedef struct struct1 S1;
+
+struct struct2
+{
+  int f3;
+  S1 f4;
+};
+typedef struct struct2 S2;
+
+
+extern void foo (S1 *ptr);
+extern S2 gstruct2_var;
+extern S1 gstruct1_var;
+
+static inline S1 bar (const S1 *ptr) __attribute__ ((always_inline));
+
+static inline S1
+bar (const S1 *ptr)
+{
+  S1 ls_var = *ptr;
+  foo (&ls_var);
+  return ls_var;
+}
+
+int
+main ()
+{
+  S2 *ps_var;
+
+  ps_var = &gstruct2_var;
+  ps_var->f4 = bar (&gstruct1_var);
+
+  return 0;
+}
+/* { dg-final { scan-tree-dump-times "short unsigned int\[^*\]*;" 0 "optimized"} } */


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

only message in thread, other threads:[~2021-01-22 17:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-22 17:11 [gcc r11-6862] Testcase for old PR 47059 Martin Jambor

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).