summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/s390/pr24624.c
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gcc.target/s390/pr24624.c
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gcc.target/s390/pr24624.c')
-rw-r--r--gcc/testsuite/gcc.target/s390/pr24624.c67
1 files changed, 67 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/s390/pr24624.c b/gcc/testsuite/gcc.target/s390/pr24624.c
new file mode 100644
index 000000000..bc2070c4b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/pr24624.c
@@ -0,0 +1,67 @@
+/* This used to ICE due to a backend problem on s390. */
+
+/* { dg-do compile } */
+/* { dg-options "-O1 -mpacked-stack" } */
+
+typedef unsigned int __u32;
+typedef struct
+{
+ volatile int counter;
+} __attribute__ ((aligned (4))) atomic_t;
+static __inline__ __attribute__ ((always_inline))
+ void atomic_inc (volatile atomic_t * v)
+{
+ (
+ {
+ typeof (v->counter) old_val, new_val;
+ __asm__ __volatile__ (
+ " l %0,0(%3)\n"
+ "0: lr %1,%0\n"
+ " ar %1,%4\n"
+ " cs %0,%1,0(%3)\n"
+ " jl 0b":
+ "=&d" (old_val), "=&d" (new_val), "=m" (((atomic_t *) (v))->counter):
+ "a" (v), "d" (1), "m" (((atomic_t *) (v))->counter):
+ "cc", "memory");
+ });
+}
+extern unsigned long volatile __attribute__ ((section (".data"))) jiffies;
+struct inet_peer
+{
+ unsigned long dtime;
+ atomic_t refcnt;
+};
+static volatile int peer_total;
+int inet_peer_threshold = 65536 + 128;
+int inet_peer_minttl = 120 * 100;
+int inet_peer_maxttl = 10 * 60 * 100;
+static int
+cleanup_once (unsigned long ttl)
+{
+ struct inet_peer *p;
+ if (p != ((void *) 0))
+ {
+ if (((
+ {
+ 1;}
+ ) && ((long) (jiffies) - (long) (p->dtime + ttl) < 0)))
+ {
+ return -1;
+ }
+ atomic_inc (&p->refcnt);
+ }
+}
+struct inet_peer *
+inet_getpeer (__u32 daddr, int create)
+{
+ int i;
+ int ttl;
+ if (peer_total >= inet_peer_threshold)
+ ttl = inet_peer_minttl;
+ else
+ ttl =
+ inet_peer_maxttl - (inet_peer_maxttl -
+ inet_peer_minttl) / 100 * peer_total /
+ inet_peer_threshold * 100;
+ for (i = 0; i < 30 && !cleanup_once (ttl); i++);
+}