summaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/pr33763.c
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-08 12:32:37 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-08 12:32:37 +0000
commit313d62a349ecb8ad8a419783fe776c7ecd5384d0 (patch)
tree7717c5e62d64af14c96a1abe2b5c0bd6b8300db2 /gcc/testsuite/c-c++-common/pr33763.c
parenta540eb41c1e6735a9a0b9c549e6be624a25c9e6a (diff)
downloadgcc-313d62a349ecb8ad8a419783fe776c7ecd5384d0.tar.gz
2012-10-08 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 192205 using svnmerge.py git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@192206 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/c-c++-common/pr33763.c')
-rw-r--r--gcc/testsuite/c-c++-common/pr33763.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/pr33763.c b/gcc/testsuite/c-c++-common/pr33763.c
new file mode 100644
index 00000000000..dbdfa77fc3d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr33763.c
@@ -0,0 +1,60 @@
+/* PR tree-optimization/33763 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+typedef struct
+{
+ void *a;
+ void *b;
+} T;
+extern void *foo (const char *, const char *);
+extern void *bar (void *, const char *, T);
+extern int baz (const char *, int);
+
+extern inline __attribute__ ((always_inline, gnu_inline)) int
+baz (const char *x, int y)
+{
+ return 2;
+}
+
+int
+baz (const char *x, int y)
+{
+ return 1;
+}
+
+int xa, xb;
+
+static void *
+inl (const char *x, const char *y)
+{
+ T t = { &xa, &xb };
+ int *f = (int *) __builtin_malloc (sizeof (int));
+ const char *z;
+ int o = 0;
+ void *r = 0;
+
+ for (z = y; *z; z++)
+ {
+ if (*z == 'r')
+ o |= 1;
+ if (*z == 'w')
+ o |= 2;
+ }
+ if (o == 1)
+ *f = baz (x, 0);
+ if (o == 2)
+ *f = baz (x, 1);
+ if (o == 3)
+ *f = baz (x, 2);
+
+ if (o && *f > 0)
+ r = bar (f, "w", t);
+ return r;
+}
+
+void *
+foo (const char *x, const char *y)
+{
+ return inl (x, y);
+}