summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.c-torture')
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr53418-1.c5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr53418-2.c5
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20120427-1.c36
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr53084.c18
4 files changed, 64 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr53418-1.c b/gcc/testsuite/gcc.c-torture/compile/pr53418-1.c
new file mode 100644
index 00000000000..721b02d7878
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr53418-1.c
@@ -0,0 +1,5 @@
+void
+f (void)
+{
+ int i = (0 ? 1 : 0U / 0);
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr53418-2.c b/gcc/testsuite/gcc.c-torture/compile/pr53418-2.c
new file mode 100644
index 00000000000..a437b6a0e62
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr53418-2.c
@@ -0,0 +1,5 @@
+void
+f (void)
+{
+ int i = (1 ? 0U / 0 : 1);
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/20120427-1.c b/gcc/testsuite/gcc.c-torture/execute/20120427-1.c
new file mode 100644
index 00000000000..46ed76ae943
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20120427-1.c
@@ -0,0 +1,36 @@
+typedef struct sreal
+{
+ unsigned sig; /* Significant. */
+ int exp; /* Exponent. */
+} sreal;
+
+sreal_compare (sreal *a, sreal *b)
+{
+ if (a->exp > b->exp)
+ return 1;
+ if (a->exp < b->exp)
+ return -1;
+ if (a->sig > b->sig)
+ return 1;
+ return -(a->sig < b->sig);
+}
+
+sreal a[] = {
+ { 0, 0 },
+ { 1, 0 },
+ { 0, 1 },
+ { 1, 1 }
+};
+
+int main()
+{
+ int i, j;
+ for (i = 0; i <= 3; i++) {
+ for (j = 0; j < 3; j++) {
+ if (i < j && sreal_compare(&a[i], &a[j]) != -1) abort();
+ if (i == j && sreal_compare(&a[i], &a[j]) != 0) abort();
+ if (i > j && sreal_compare(&a[i], &a[j]) != 1) abort();
+ }
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr53084.c b/gcc/testsuite/gcc.c-torture/execute/pr53084.c
new file mode 100644
index 00000000000..1afc016dfc4
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr53084.c
@@ -0,0 +1,18 @@
+/* PR middle-end/53084 */
+
+extern void abort (void);
+
+__attribute__((noinline, noclone)) void
+bar (const char *p)
+{
+ if (p[0] != 'o' || p[1] != 'o' || p[2])
+ abort ();
+}
+
+int
+main ()
+{
+ static const char *const foo[] = {"foo" + 1};
+ bar (foo[0]);
+ return 0;
+}