summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/torture
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/torture')
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr51071-2.c38
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr51071.c33
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr52407.c33
3 files changed, 104 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/torture/pr51071-2.c b/gcc/testsuite/gcc.dg/torture/pr51071-2.c
new file mode 100644
index 00000000000..f66a89f3958
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr51071-2.c
@@ -0,0 +1,38 @@
+/* { dg-do compile } */
+/* { dg-options "-fno-delete-null-pointer-checks" } */
+
+extern struct module __this_module;
+static inline void
+trace_module_get (struct module *mod, unsigned long ip) { }
+struct module;
+static inline __attribute__((no_instrument_function))
+int try_module_get(struct module *module)
+{
+ int ret = 1;
+ if (module)
+ {
+ if (module_is_live(module))
+ {
+ __label__ __here;
+ asm("");
+ __here:
+ trace_module_get(module, (unsigned long)&&__here);
+ }
+ else
+ ret = 0;
+ }
+ return ret;
+}
+struct net_device;
+struct net_device_ops {
+ int (*ndo_open)(struct net_device *dev);
+};
+int t3e3_open(struct net_device *dev)
+{
+ int ret = hdlc_open(dev);
+ if (ret)
+ return ret;
+ try_module_get((&__this_module));
+ return 0;
+}
+const struct net_device_ops t3e3_ops = { .ndo_open = t3e3_open };
diff --git a/gcc/testsuite/gcc.dg/torture/pr51071.c b/gcc/testsuite/gcc.dg/torture/pr51071.c
new file mode 100644
index 00000000000..99af9587d05
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr51071.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+
+void foo (void);
+void bar (void *);
+extern int t;
+
+static void kmalloc_large (int size, int flags)
+{
+ (void) size;
+ (void) flags;
+ foo ();
+ bar (({__here:&&__here;}));
+}
+
+static void kmalloc (int size, int flags)
+{
+ if (size)
+ {
+ if ((unsigned long) size > 0x1000)
+ kmalloc_large (size, flags);
+
+ if (flags)
+ bar (({__here:&&__here;}));
+ }
+}
+
+void compress_file_range (int i, int j, int k)
+{
+ int nr_pages = ({j < k;});
+
+ if (i || t)
+ kmalloc (0x1000UL * nr_pages, 0x40UL);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr52407.c b/gcc/testsuite/gcc.dg/torture/pr52407.c
new file mode 100644
index 00000000000..bb95e51f25b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr52407.c
@@ -0,0 +1,33 @@
+/* { dg-do run } */
+
+extern void abort (void);
+
+typedef long long T;
+typedef T vl_t __attribute__((vector_size(2 * sizeof (T))));
+
+vl_t ul[4], vl[4] = { { 1, 2 }, { 3, 4 }, { 5, 6 }, { 7, 8 } };
+
+static void
+mul_vl_l(vl_t *u, vl_t *v, T x, int m)
+{
+ vl_t w;
+ T *p = (T *)&w;
+ p[0] = p[1] = x;
+ while (m--)
+ *u++ = *v++ * w;
+}
+
+int
+main(int argc, char *argv[])
+{
+ int i;
+ T *pl;
+
+ pl = (T *) &ul;
+ mul_vl_l(ul, vl, 2, 4);
+ for (i = 0; i < 8; i++)
+ if (pl[i] != 2 * (i + 1))
+ abort ();
+
+ return 0;
+}