summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/ipa/iinline-6.c
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2012-08-29 12:37:05 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2012-08-29 12:37:05 +0000
commit12cb78d1cca1387a092ec0bd49c250340bff4afc (patch)
tree1eab97da96906e0a2786d51d9f25f20de02befcf /gcc/testsuite/gcc.dg/ipa/iinline-6.c
parent31879e18aea3222fe3e56f2c0319c9f230645ff3 (diff)
downloadgcc-12cb78d1cca1387a092ec0bd49c250340bff4afc.tar.gz
2012-08-29 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 190745 using svnmerge, notably C++ conversion. [gcc/] 2012-08-29 Basile Starynkevitch <basile@starynkevitch.net> {{merging with trunk, converted to C++}} * melt-runtime.h (MELT_FLEXIBLE_DIM): Set when C++. * melt-runtime.c (melt_tempdir_path): Don't use choose_tmpdir from libiberty. (meltgc_start_module_by_index): Use address-of & on VEC_index. (melt_really_initialize): When printing builtin settings, handle GCC 4.8 as with implicit ENABLE_BUILD_WITH_CXX. (meltgc_out_edge): Provide additional flag TDF_DETAILS for dump_edge_info. (melt_val2passflag): Handle PROP_referenced_vars only when defined. * melt-module.mk: Use GCCMELT_COMPILER instead of GCCMELT_CC. * melt-build-script.tpl: Transmit GCCMELT_COMPILER on every make using melt-module.mk and improve the error message. * melt-build-script.sh: Regenerate. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@190778 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/ipa/iinline-6.c')
-rw-r--r--gcc/testsuite/gcc.dg/ipa/iinline-6.c72
1 files changed, 72 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/ipa/iinline-6.c b/gcc/testsuite/gcc.dg/ipa/iinline-6.c
new file mode 100644
index 00000000000..5a9b759d883
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/iinline-6.c
@@ -0,0 +1,72 @@
+/* Verify that simple indirect calls are inlined even without early
+ inlining.. */
+/* { dg-do run } */
+/* { dg-options "-O3 -fdump-ipa-inline -fno-early-inlining" } */
+
+extern void abort (void);
+
+struct S
+{
+ int i;
+ void (*f)(struct S *);
+ int j,k,l;
+};
+
+struct Z
+{
+ unsigned u;
+ void (*f)(struct Z *, int);
+ struct Z *next;
+};
+
+static struct S *gs;
+static int gr = 111;
+char gc[1024];
+
+static __attribute__ ((noinline, noclone)) struct S *
+get_s (void)
+{
+ return (struct S *) &gc;
+}
+
+static void wrong_target (struct S *s)
+{
+ abort ();
+}
+
+static void good_target (struct S *s)
+{
+ gr = 0;
+}
+
+static void g1 (struct S *s)
+{
+ s->f (s);
+}
+
+static void f2 (struct Z *z)
+{
+ gs->f = good_target;
+ g1 ((struct S *) z);
+}
+
+static inline __attribute__ ((flatten)) void f1 (struct S *s)
+{
+ f2 ((struct Z *) s);
+}
+
+int main (int argc, char **argv)
+{
+ struct S *s = get_s();
+ s->i = 5678;
+ s->f = wrong_target;
+ s->j = 1234;
+ gs = s;
+ f1 (s);
+
+ return gr;
+}
+
+
+/* { dg-final { scan-ipa-dump-not "wrong_target\[^\\n\]*inline copy in" "inline" } } */
+/* { dg-final { cleanup-ipa-dump "inline" } } */