diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/torture')
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr25967-1.c | 63 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr25967-2.c | 58 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr70992-2.c | 9 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr70992.c | 41 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr78218.c | 11 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr80163.c | 1 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr81181.c | 30 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr81297.c | 16 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr81500.c | 13 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr81510-2.c | 19 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr81510.c | 29 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr81571.c | 13 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr81573.c | 16 |
13 files changed, 315 insertions, 4 deletions
diff --git a/gcc/testsuite/gcc.dg/torture/pr25967-1.c b/gcc/testsuite/gcc.dg/torture/pr25967-1.c new file mode 100644 index 00000000000..fd26a8b8ce3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr25967-1.c @@ -0,0 +1,63 @@ +/* { dg-do run { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-mgeneral-regs-only" } */ + +extern void exit (int); + +typedef unsigned int uword_t __attribute__ ((mode (__word__))); + +#define ERROR 0x12345670 +#define IP 0x12345671 +#define CS 0x12345672 +#define FLAGS 0x12345673 +#define SP 0x12345674 +#define SS 0x12345675 + +#define STRING(x) XSTRING(x) +#define XSTRING(x) #x +#define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname) +#define ASMNAME2(prefix, cname) XSTRING (prefix) cname + +struct interrupt_frame +{ + uword_t ip; + uword_t cs; + uword_t flags; + uword_t sp; + uword_t ss; +}; + +__attribute__((naked, used)) +void +fn (void) +{ + register uword_t *sp __asm__("sp"); + uword_t error = *sp; + struct interrupt_frame *frame = (struct interrupt_frame *) (sp + 1); + if (ERROR != error) /* BREAK */ + __builtin_abort (); + if (IP != frame->ip) + __builtin_abort (); + if (CS != frame->cs) + __builtin_abort (); + if (FLAGS != frame->flags) + __builtin_abort (); + if (SP != frame->sp) + __builtin_abort (); + if (SS != frame->ss) + __builtin_abort (); + + exit (0); +} + +int +main () +{ + asm ("push $" STRING (SS) "; \ + push $" STRING (SP) "; \ + push $" STRING (FLAGS) "; \ + push $" STRING (CS) "; \ + push $" STRING (IP) "; \ + push $" STRING (ERROR) "; \ + jmp " ASMNAME ("fn")); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr25967-2.c b/gcc/testsuite/gcc.dg/torture/pr25967-2.c new file mode 100644 index 00000000000..4a0dd78c0ad --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr25967-2.c @@ -0,0 +1,58 @@ +/* { dg-do run { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-mgeneral-regs-only" } */ + +extern void exit (int); + +typedef unsigned int uword_t __attribute__ ((mode (__word__))); + +#define IP 0x12345671 +#define CS 0x12345672 +#define FLAGS 0x12345673 +#define SP 0x12345674 +#define SS 0x12345675 + +#define STRING(x) XSTRING(x) +#define XSTRING(x) #x +#define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname) +#define ASMNAME2(prefix, cname) XSTRING (prefix) cname + +struct interrupt_frame +{ + uword_t ip; + uword_t cs; + uword_t flags; + uword_t sp; + uword_t ss; +}; + +__attribute__((naked, used)) +void +fn (void) +{ + register uword_t *sp __asm__("sp"); + struct interrupt_frame *frame = (struct interrupt_frame *) sp; + if (IP != frame->ip) /* BREAK */ + __builtin_abort (); + if (CS != frame->cs) + __builtin_abort (); + if (FLAGS != frame->flags) + __builtin_abort (); + if (SP != frame->sp) + __builtin_abort (); + if (SS != frame->ss) + __builtin_abort (); + + exit (0); +} + +int +main () +{ + asm ("push $" STRING (SS) "; \ + push $" STRING (SP) "; \ + push $" STRING (FLAGS) "; \ + push $" STRING (CS) "; \ + push $" STRING (IP) "; \ + jmp " ASMNAME ("fn")); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr70992-2.c b/gcc/testsuite/gcc.dg/torture/pr70992-2.c new file mode 100644 index 00000000000..c5d2c5f2683 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr70992-2.c @@ -0,0 +1,9 @@ +/* PR middle-end/70992 */ +/* { dg-do compile } */ + +unsigned int *od; +int +fn (void) +{ + return (0 % 0 + 1) * *od * 2; /* { dg-warning "division by zero" } */ +} diff --git a/gcc/testsuite/gcc.dg/torture/pr70992.c b/gcc/testsuite/gcc.dg/torture/pr70992.c new file mode 100644 index 00000000000..56728e09d1b --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr70992.c @@ -0,0 +1,41 @@ +/* PR middle-end/70992 */ +/* { dg-do compile } */ + +typedef unsigned int uint32_t; +typedef int int32_t; + +uint32_t +fn (uint32_t so) +{ + return (so + so) * (0x80000000 / 0 + 1); /* { dg-warning "division by zero" } */ +} + +uint32_t +fn5 (uint32_t so) +{ + return (0x80000000 / 0 + 1) * (so + so); /* { dg-warning "division by zero" } */ +} + +uint32_t +fn6 (uint32_t so) +{ + return (0x80000000 / 0 - 1) * (so + so); /* { dg-warning "division by zero" } */ +} + +uint32_t +fn2 (uint32_t so) +{ + return (so + so) * (0x80000000 / 0 - 1); /* { dg-warning "division by zero" } */ +} + +int32_t +fn3 (int32_t so) +{ + return (so + so) * (0x80000000 / 0 + 1); /* { dg-warning "division by zero" } */ +} + +int32_t +fn4 (int32_t so) +{ + return (so + so) * (0x80000000 / 0 - 1); /* { dg-warning "division by zero" } */ +} diff --git a/gcc/testsuite/gcc.dg/torture/pr78218.c b/gcc/testsuite/gcc.dg/torture/pr78218.c index b3e2892429d..fd6ddc9d90d 100644 --- a/gcc/testsuite/gcc.dg/torture/pr78218.c +++ b/gcc/testsuite/gcc.dg/torture/pr78218.c @@ -1,15 +1,18 @@ /* { dg-do run } */ -struct +struct v { int v; -} a[2]; +}; -int b; +struct v a[2]; + +struct v *gp; void __attribute__((noinline,noclone)) -check () +check (struct v *p) { + gp = p; if (a[0].v != 1) __builtin_abort (); } diff --git a/gcc/testsuite/gcc.dg/torture/pr80163.c b/gcc/testsuite/gcc.dg/torture/pr80163.c index 80cc68dd76d..a9a4438d66f 100644 --- a/gcc/testsuite/gcc.dg/torture/pr80163.c +++ b/gcc/testsuite/gcc.dg/torture/pr80163.c @@ -1,5 +1,6 @@ /* PR c/80163 */ /* { dg-do compile { target int128 } } */ +/* { dg-require-effective-target label_values } */ volatile int v; diff --git a/gcc/testsuite/gcc.dg/torture/pr81181.c b/gcc/testsuite/gcc.dg/torture/pr81181.c new file mode 100644 index 00000000000..e7216d7bf3e --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr81181.c @@ -0,0 +1,30 @@ +/* { dg-do compile } */ + +unsigned int lh; + +void +ny (int t3, int ys, int rt, int p8) +{ + if (lh != 0) + { + if (0) + { +oo: + do + { + rt = (p8 != 0) ? t3 : 0; + rt = (rt != 0 || lh != (unsigned int)ys); + rt += lh + ys; + } + while (t3 <= 0); + + lh = ys; + ys = rt; + } + + if (lh != 0) + p8 = lh; + } + + goto oo; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr81297.c b/gcc/testsuite/gcc.dg/torture/pr81297.c new file mode 100644 index 00000000000..be346c4c0d1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr81297.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ + +int +nf (int gy, int x0) +{ + while (gy < 1) + ++x0; + + gy += !!gy; + if (gy < 0) + { + x0 += gy; + return (x0 > (gy + x0)) ? (1 / 0) : 1; /* { dg-warning "division by zero" } */ + } +} + diff --git a/gcc/testsuite/gcc.dg/torture/pr81500.c b/gcc/testsuite/gcc.dg/torture/pr81500.c new file mode 100644 index 00000000000..7aaec2189fc --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr81500.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ + +typedef int a; +void c(int *b) +{ + int d; + a e, f, *g, *h = b; + for (; d; d--) { + f = *g & 1; + *h-- = *g-- | e; + e = f; + } +} diff --git a/gcc/testsuite/gcc.dg/torture/pr81510-2.c b/gcc/testsuite/gcc.dg/torture/pr81510-2.c new file mode 100644 index 00000000000..7e2bc9866f7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr81510-2.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ + +typedef int h; +typedef int k; +int a; +int b; +int c; +int d; +int e; +int f(int g) +{ + h *i = &e; + k *j; + if (d -= b) + for (; *j; *j += 1) { + g = g || (a = e ? c = (__UINTPTR_TYPE__)j : 0) + *i; + i = &d; + } +} diff --git a/gcc/testsuite/gcc.dg/torture/pr81510.c b/gcc/testsuite/gcc.dg/torture/pr81510.c new file mode 100644 index 00000000000..c93c4683629 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr81510.c @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-w" } */ + +typedef int d; +typedef int f; +typedef long h; +int a; +int b; +int c; +int e() +{ + f *g; + h i; + for (;;) + if (g) + for (; b; b++) { + g = c; + if (a &= c) { + d *j = &b; + h k; + for (; i; i++) { + *g ?: (*j = k); + g = &a; + } + for (; i <= 3; i++) + ; + } + } +} diff --git a/gcc/testsuite/gcc.dg/torture/pr81571.c b/gcc/testsuite/gcc.dg/torture/pr81571.c new file mode 100644 index 00000000000..74bceb763ea --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr81571.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ + +int a, b, c, d; +short fn1(int p1, int p2) { return p1; } + +int fn2(int p1) {} + +int main() +{ + for (; c; c++) + a |= fn1(1, a) | fn2(b |= d); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr81573.c b/gcc/testsuite/gcc.dg/torture/pr81573.c new file mode 100644 index 00000000000..3930c56386b --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr81573.c @@ -0,0 +1,16 @@ +/* { dg-do run } */ + +int a = 1, *c = &a, d; +signed char b; + +int main () +{ + for (; b > -27; b--) + { + *c ^= b; + *c ^= 1; + } + while (a > 1) + ; + return 0; +} |