memset-4.c: New test.
authorAndrew Pinski <apinski@cavium.com>
Sun, 16 Nov 2014 08:01:09 +0000 (08:01 +0000)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Sun, 16 Nov 2014 08:01:09 +0000 (00:01 -0800)
2014-11-16  Andrew Pinski  <apinski@cavium.com>

* gcc.c-torture/execute/memset-4.c: New test.
* gcc.c-torture/execute/20110418-1.c: New test.
* gcc.c-torture/execute/20141022-1.c: New test.
* gcc.c-torture/execute/strcpy-2.c: New test.
* gcc.c-torture/execute/20140212-2.c: New test.
* gcc.c-torture/compile/20120913-1.c: New test.
* gcc.c-torture/compile/20121010-1.c: New test.
* gcc.c-torture/compile/20120917-1.c: New test.
* gcc.c-torture/compile/20140110-1.c: New test.
* gcc.c-torture/compile/20121220-1.c: New test.
* gcc.c-torture/compile/20120822-1.c: New test.
* gcc.c-torture/compile/20121027-1.c: New test.
* gcc.c-torture/compile/20120830-2.c: New test.

From-SVN: r217625

14 files changed:
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/20120822-1.c [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/compile/20120830-2.c [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/compile/20120913-1.c [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/compile/20120917-1.c [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/compile/20121010-1.c [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/compile/20121027-1.c [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/compile/20121220-1.c [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/compile/20140110-1.c [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/execute/20110418-1.c [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/execute/20140212-2.c [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/execute/20141022-1.c [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/execute/memset-4.c [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/execute/strcpy-2.c [new file with mode: 0644]

index fdb726568d629b4cc6df3db74ae8b63f94e95c8b..87cb8d8c1914de4c523cc7baf91b2aba8e7b4f72 100644 (file)
@@ -1,3 +1,19 @@
+2014-11-16  Andrew Pinski  <apinski@cavium.com>
+
+       * gcc.c-torture/execute/memset-4.c: New test.
+       * gcc.c-torture/execute/20110418-1.c: New test.
+       * gcc.c-torture/execute/20141022-1.c: New test.
+       * gcc.c-torture/execute/strcpy-2.c: New test.
+       * gcc.c-torture/execute/20140212-2.c: New test.
+       * gcc.c-torture/compile/20120913-1.c: New test.
+       * gcc.c-torture/compile/20121010-1.c: New test.
+       * gcc.c-torture/compile/20120917-1.c: New test.
+       * gcc.c-torture/compile/20140110-1.c: New test.
+       * gcc.c-torture/compile/20121220-1.c: New test.
+       * gcc.c-torture/compile/20120822-1.c: New test.
+       * gcc.c-torture/compile/20121027-1.c: New test.
+       * gcc.c-torture/compile/20120830-2.c: New test.
+
 2014-11-15  Maciej W. Rozycki  <macro@codesourcery.com>
 
        * g++.dg/guality/guality.exp (check_guality): Fix `test_counts'
diff --git a/gcc/testsuite/gcc.c-torture/compile/20120822-1.c b/gcc/testsuite/gcc.c-torture/compile/20120822-1.c
new file mode 100644 (file)
index 0000000..0298c60
--- /dev/null
@@ -0,0 +1,11 @@
+int a;
+int c;
+int b;
+void shr_long(int d, unsigned char s)
+{
+ long long dvd, div, mod;
+ dvd = b;
+ mod = dvd % s;
+ if (((c >> ((mod & 0xff) % 32)) & 1) == 0)
+  a = 1;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20120830-2.c b/gcc/testsuite/gcc.c-torture/compile/20120830-2.c
new file mode 100644 (file)
index 0000000..27479b6
--- /dev/null
@@ -0,0 +1,5 @@
+ubidi_writeReordered_49( int *dest, const unsigned char *dirProps) 
+{
+    if (!(1&(1UL<<*dirProps)))
+      *dest=1;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20120913-1.c b/gcc/testsuite/gcc.c-torture/compile/20120913-1.c
new file mode 100644 (file)
index 0000000..f63babd
--- /dev/null
@@ -0,0 +1,17 @@
+struct list_head {
+  struct list_head *next, *prev;
+};
+struct dm_exception {
+  struct list_head hash_list;
+  unsigned long long old_chunk;
+  unsigned long long new_chunk;
+};
+struct dm_exception *dm_lookup_exception(struct list_head *table, unsigned long long chunk) {
+  struct list_head *slot;
+  struct dm_exception *e;
+  slot = &table[0];
+  e = (struct dm_exception *)slot->next;
+  for (; &e->hash_list != (slot);)
+    if (chunk <= (e->new_chunk>>56))
+      return e;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20120917-1.c b/gcc/testsuite/gcc.c-torture/compile/20120917-1.c
new file mode 100644 (file)
index 0000000..b469514
--- /dev/null
@@ -0,0 +1,13 @@
+typedef long long curl_off_t;
+int tool_seek_cb(void *userdata, curl_off_t offset, int whence)
+{
+  if(offset > 0x7FFFFFFFLL - 0x1LL) 
+{
+    curl_off_t left = offset;
+    while(left) 
+{
+      long step = (left > 0x7FFFFFFFLL - 0x1LL) ? 2147483647L - 1L : (long)left;
+      left -= step;
+    }
+  }
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20121010-1.c b/gcc/testsuite/gcc.c-torture/compile/20121010-1.c
new file mode 100644 (file)
index 0000000..9fac9b8
--- /dev/null
@@ -0,0 +1,10 @@
+int _IO_getc(int*);
+read_long(int *fp)
+{
+  unsigned char b0, b1, b2, b3;
+  b0 = _IO_getc (fp);
+  b1 = _IO_getc (fp);
+  b2 = _IO_getc (fp);
+  b3 = _IO_getc (fp);
+  return ((int)(((((b3 << 8) | b2) << 8) | b1) << 8) | b0);
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20121027-1.c b/gcc/testsuite/gcc.c-torture/compile/20121027-1.c
new file mode 100644 (file)
index 0000000..3d3ff31
--- /dev/null
@@ -0,0 +1,13 @@
+extern int nc;
+void f(void)
+{
+    unsigned char resp[1024];
+    int c;
+    int bl = 0;
+    unsigned long long *dwords = (unsigned long long *)(resp + 5);
+    for (c=0; c<nc; c++)
+    {
+        ff(dwords[bl/64]);
+        bl++;
+    }
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20121220-1.c b/gcc/testsuite/gcc.c-torture/compile/20121220-1.c
new file mode 100644 (file)
index 0000000..05edb99
--- /dev/null
@@ -0,0 +1,14 @@
+typedef unsigned char uint8_t;
+typedef unsigned int uint32_t;
+static __attribute__ (( always_inline )) __inline__
+void rop_8_notsrc_or_dst(uint8_t *dst, uint8_t src)
+{
+  *dst = (~(src)) | (*dst);
+}
+void cirrus_colorexpand_notsrc_or_dst_8 (uint8_t * dst, int bits)
+{
+  uint8_t src;
+  uint32_t colors[2];
+  src = colors[bits];
+  rop_8_notsrc_or_dst(dst, src);
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20140110-1.c b/gcc/testsuite/gcc.c-torture/compile/20140110-1.c
new file mode 100644 (file)
index 0000000..c1bd799
--- /dev/null
@@ -0,0 +1,14 @@
+typedef long unsigned int size_t;
+struct RangeMapRange {
+  unsigned fromMin;
+  unsigned fromMax;
+  unsigned toMin;
+};
+void reserve1(void);
+void f(struct RangeMapRange *q1, size_t t)
+{
+  const struct RangeMapRange *q2 = q1 + t;
+  size_t n = q2 - q1;
+  if (n > 0)
+    reserve1();
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/20110418-1.c b/gcc/testsuite/gcc.c-torture/execute/20110418-1.c
new file mode 100644 (file)
index 0000000..df26360
--- /dev/null
@@ -0,0 +1,29 @@
+typedef unsigned long long uint64_t;
+void f(uint64_t *a, uint64_t aa) __attribute__((noinline));
+void f(uint64_t *a, uint64_t aa)
+{
+  uint64_t new_value = aa;
+  uint64_t old_value = *a;
+  int bit_size = 32;
+    uint64_t mask = (uint64_t)(unsigned)(-1);
+    uint64_t tmp = old_value & mask;
+    new_value &= mask;
+    /* On overflow we need to add 1 in the upper bits */
+    if (tmp > new_value)
+        new_value += 1ull<<bit_size;
+    /* Add in the upper bits from the old value */
+    new_value += old_value & ~mask;
+    *a = new_value;
+}
+int main(void)
+{
+  uint64_t value, new_value, old_value;
+  value = 0x100000001;
+  old_value = value;
+  new_value = (value+1)&(uint64_t)(unsigned)(-1);
+  f(&value, new_value);
+  if (value != old_value+1)
+    __builtin_abort ();
+  return 0;
+}
+
diff --git a/gcc/testsuite/gcc.c-torture/execute/20140212-2.c b/gcc/testsuite/gcc.c-torture/execute/20140212-2.c
new file mode 100644 (file)
index 0000000..93385ec
--- /dev/null
@@ -0,0 +1,21 @@
+/* This used to fail as we would convert f into just return (unsigned int)usVlanID
+   which is wrong. */
+
+int f(unsigned short usVlanID) __attribute__((noinline,noclone));
+int f(unsigned short usVlanID)
+{
+  unsigned int uiVlanID = 0xffffffff;
+  int i;
+  if ((unsigned short)0xffff != usVlanID)
+    uiVlanID = (unsigned int)usVlanID;
+  return uiVlanID;
+}
+
+int main(void)
+{
+  if (f(1) != 1)
+    __builtin_abort ();
+  if (f(0xffff) != -1)
+    __builtin_abort ();
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/20141022-1.c b/gcc/testsuite/gcc.c-torture/execute/20141022-1.c
new file mode 100644 (file)
index 0000000..ab71877
--- /dev/null
@@ -0,0 +1,25 @@
+#define ABORT() do { __builtin_printf("assert.\n");  __builtin_abort (); }while(0)
+int f(int a) __attribute__((noinline));
+int f(int a)
+{
+  int fem_key_src;
+  int D2930 = a & 4294967291;
+  fem_key_src = a == 6 ? 0 : 15;
+  fem_key_src = D2930 != 1 ? fem_key_src : 0;
+  return fem_key_src;
+}
+
+int main(void)
+{
+  if (f(0) != 15)
+    ABORT ();
+  if (f(1) != 0)
+    ABORT ();
+  if (f(6) != 0)
+    ABORT ();
+  if (f(5) != 0)
+    ABORT ();
+  if (f(15) != 15)
+    ABORT ();
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/memset-4.c b/gcc/testsuite/gcc.c-torture/execute/memset-4.c
new file mode 100644 (file)
index 0000000..2ac445c
--- /dev/null
@@ -0,0 +1,27 @@
+/* Test to make sure memset of small old size works
+   correctly. */
+#define SIZE 15
+
+void f(char *a) __attribute__((noinline));
+void f(char *a)
+{
+  __builtin_memset (a, 0, SIZE);
+}
+
+
+int main(void)
+{
+  int i;
+  char b[SIZE];
+  for(i = 0; i < sizeof(b); i++)
+    {
+      b[i] = i;
+    }
+  f(b);
+  for(i = 0; i < sizeof(b); i++)
+    {
+      if (0 != b[i])
+       __builtin_abort ();
+    }
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/strcpy-2.c b/gcc/testsuite/gcc.c-torture/execute/strcpy-2.c
new file mode 100644 (file)
index 0000000..78a00c3
--- /dev/null
@@ -0,0 +1,24 @@
+/* Test to make sure strcpy works correctly. */
+#define STRING "Hi!THE"
+
+const char a[] = STRING;
+
+void f(char *a) __attribute__((noinline));
+void f(char *a)
+{
+  __builtin_strcpy (a, STRING);
+}
+
+
+int main(void)
+{
+  int i;
+  char b[sizeof(a)] = {};
+  f(b);
+  for(i = 0; i < sizeof(b); i++)
+    {
+      if (a[i] != b[i])
+       __builtin_abort ();
+    }
+  return 0;
+}