summaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/c-c++-common')
-rw-r--r--gcc/testsuite/c-c++-common/Wconversion-real.c85
-rw-r--r--gcc/testsuite/c-c++-common/Wint-to-pointer-cast-1.c12
-rw-r--r--gcc/testsuite/c-c++-common/Wint-to-pointer-cast-2.c12
-rw-r--r--gcc/testsuite/c-c++-common/Wint-to-pointer-cast-3.c22
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-var-1.c179
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-var-10.c68
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-var-11.c12
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-var-12.c26
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-var-13.c27
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-var-14.c13
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-var-2.c20
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-var-3.c37
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-var-4.c29
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-var-5.c33
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-var-6.c15
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-var-7.c48
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-var-8.c19
-rw-r--r--gcc/testsuite/c-c++-common/Wunused-var-9.c80
-rw-r--r--gcc/testsuite/c-c++-common/abi-bf.c3
-rw-r--r--gcc/testsuite/c-c++-common/asmgoto-1.c15
-rw-r--r--gcc/testsuite/c-c++-common/asmgoto-2.c20
-rw-r--r--gcc/testsuite/c-c++-common/asmgoto-3.c10
-rw-r--r--gcc/testsuite/c-c++-common/asmgoto-4.c44
-rw-r--r--gcc/testsuite/c-c++-common/attr-used-2.c11
-rw-r--r--gcc/testsuite/c-c++-common/attr-used.c13
-rw-r--r--gcc/testsuite/c-c++-common/builtin-offsetof.c29
-rw-r--r--gcc/testsuite/c-c++-common/cpp/normalize-3.c35
-rw-r--r--gcc/testsuite/c-c++-common/cpp/pr45457.c18
-rw-r--r--gcc/testsuite/c-c++-common/cpp/warning-directive-1.c4
-rw-r--r--gcc/testsuite/c-c++-common/cpp/warning-directive-2.c5
-rw-r--r--gcc/testsuite/c-c++-common/cpp/warning-directive-3.c4
-rw-r--r--gcc/testsuite/c-c++-common/cpp/warning-directive-4.c4
-rw-r--r--gcc/testsuite/c-c++-common/dfp/call-by-value.c43
-rw-r--r--gcc/testsuite/c-c++-common/dfp/cast.c75
-rw-r--r--gcc/testsuite/c-c++-common/dfp/compare-eq-const.c28
-rw-r--r--gcc/testsuite/c-c++-common/dfp/compare-eq-d128.c14
-rw-r--r--gcc/testsuite/c-c++-common/dfp/compare-eq-d32.c14
-rw-r--r--gcc/testsuite/c-c++-common/dfp/compare-eq-d64.c14
-rw-r--r--gcc/testsuite/c-c++-common/dfp/compare-eq-dfp.c53
-rw-r--r--gcc/testsuite/c-c++-common/dfp/compare-eq.h92
-rw-r--r--gcc/testsuite/c-c++-common/dfp/compare-rel-const.c57
-rw-r--r--gcc/testsuite/c-c++-common/dfp/compare-rel-d128.c14
-rw-r--r--gcc/testsuite/c-c++-common/dfp/compare-rel-d32.c14
-rw-r--r--gcc/testsuite/c-c++-common/dfp/compare-rel-d64.c14
-rw-r--r--gcc/testsuite/c-c++-common/dfp/compare-rel-dfp.c53
-rw-r--r--gcc/testsuite/c-c++-common/dfp/compare-rel.h132
-rw-r--r--gcc/testsuite/c-c++-common/dfp/compare-special-d128.c15
-rw-r--r--gcc/testsuite/c-c++-common/dfp/compare-special-d32.c15
-rw-r--r--gcc/testsuite/c-c++-common/dfp/compare-special-d64.c15
-rw-r--r--gcc/testsuite/c-c++-common/dfp/compare-special.h284
-rw-r--r--gcc/testsuite/c-c++-common/dfp/constants-zero.c159
-rw-r--r--gcc/testsuite/c-c++-common/dfp/convert-bfp-10.c107
-rw-r--r--gcc/testsuite/c-c++-common/dfp/convert-bfp-11.c58
-rw-r--r--gcc/testsuite/c-c++-common/dfp/convert-bfp-12.c16
-rw-r--r--gcc/testsuite/c-c++-common/dfp/convert-bfp-13.c18
-rw-r--r--gcc/testsuite/c-c++-common/dfp/convert-bfp-14.c15
-rw-r--r--gcc/testsuite/c-c++-common/dfp/convert-bfp-2.c33
-rw-r--r--gcc/testsuite/c-c++-common/dfp/convert-bfp-3.c21
-rw-r--r--gcc/testsuite/c-c++-common/dfp/convert-bfp-4.c21
-rw-r--r--gcc/testsuite/c-c++-common/dfp/convert-bfp-5.c21
-rw-r--r--gcc/testsuite/c-c++-common/dfp/convert-bfp-6.c178
-rw-r--r--gcc/testsuite/c-c++-common/dfp/convert-bfp-7.c83
-rw-r--r--gcc/testsuite/c-c++-common/dfp/convert-bfp-8.c71
-rw-r--r--gcc/testsuite/c-c++-common/dfp/convert-bfp-9.c192
-rw-r--r--gcc/testsuite/c-c++-common/dfp/convert-bfp-fold.c118
-rw-r--r--gcc/testsuite/c-c++-common/dfp/convert-bfp.c131
-rw-r--r--gcc/testsuite/c-c++-common/dfp/convert-dfp-fold-2.c15
-rw-r--r--gcc/testsuite/c-c++-common/dfp/convert-dfp-fold.c47
-rw-r--r--gcc/testsuite/c-c++-common/dfp/convert-dfp.c94
-rw-r--r--gcc/testsuite/c-c++-common/dfp/convert-int-fold.c173
-rw-r--r--gcc/testsuite/c-c++-common/dfp/convert-int-max-fold.c148
-rw-r--r--gcc/testsuite/c-c++-common/dfp/convert-int-max.c146
-rw-r--r--gcc/testsuite/c-c++-common/dfp/convert-int-saturate.c64
-rw-r--r--gcc/testsuite/c-c++-common/dfp/convert-int.c199
-rw-r--r--gcc/testsuite/c-c++-common/dfp/convert.h462
-rw-r--r--gcc/testsuite/c-c++-common/dfp/dfp-dbg.h20
-rw-r--r--gcc/testsuite/c-c++-common/dfp/func-array.c157
-rw-r--r--gcc/testsuite/c-c++-common/dfp/func-deref.c205
-rw-r--r--gcc/testsuite/c-c++-common/dfp/func-mixed.c174
-rw-r--r--gcc/testsuite/c-c++-common/dfp/func-pointer.c205
-rw-r--r--gcc/testsuite/c-c++-common/dfp/func-scalar.c192
-rw-r--r--gcc/testsuite/c-c++-common/dfp/func-struct.c93
-rw-r--r--gcc/testsuite/c-c++-common/dfp/func-vararg-alternate-d128-2.c22
-rw-r--r--gcc/testsuite/c-c++-common/dfp/func-vararg-alternate-d128.c19
-rw-r--r--gcc/testsuite/c-c++-common/dfp/func-vararg-alternate-d32.c19
-rw-r--r--gcc/testsuite/c-c++-common/dfp/func-vararg-alternate-d64.c19
-rw-r--r--gcc/testsuite/c-c++-common/dfp/func-vararg-alternate.h143
-rw-r--r--gcc/testsuite/c-c++-common/dfp/func-vararg-dfp.c95
-rw-r--r--gcc/testsuite/c-c++-common/dfp/func-vararg-mixed-2.c105
-rw-r--r--gcc/testsuite/c-c++-common/dfp/func-vararg-mixed.c102
-rw-r--r--gcc/testsuite/c-c++-common/dfp/func-vararg-size0.c41
-rw-r--r--gcc/testsuite/c-c++-common/dfp/inf-1.c61
-rw-r--r--gcc/testsuite/c-c++-common/dfp/loop-index.c57
-rw-r--r--gcc/testsuite/c-c++-common/dfp/modes.c14
-rw-r--r--gcc/testsuite/c-c++-common/dfp/nan-1.c106
-rw-r--r--gcc/testsuite/c-c++-common/dfp/nan-2.c53
-rw-r--r--gcc/testsuite/c-c++-common/dfp/operator-arith-fold.c45
-rw-r--r--gcc/testsuite/c-c++-common/dfp/operator-assignment.c56
-rw-r--r--gcc/testsuite/c-c++-common/dfp/operator-comma.c47
-rw-r--r--gcc/testsuite/c-c++-common/dfp/operator-cond.c57
-rw-r--r--gcc/testsuite/c-c++-common/dfp/operator-logical.c63
-rw-r--r--gcc/testsuite/c-c++-common/dfp/operator-unary.c52
-rw-r--r--gcc/testsuite/c-c++-common/dfp/pr31385.c30
-rw-r--r--gcc/testsuite/c-c++-common/dfp/pr33466.c13
-rw-r--r--gcc/testsuite/c-c++-common/dfp/pr35620.c27
-rw-r--r--gcc/testsuite/c-c++-common/dfp/pr36800.c32
-rw-r--r--gcc/testsuite/c-c++-common/dfp/pr39034.c100
-rw-r--r--gcc/testsuite/c-c++-common/dfp/pr39035.c71
-rw-r--r--gcc/testsuite/c-c++-common/dfp/pr39902.c226
-rw-r--r--gcc/testsuite/c-c++-common/dfp/pr39986.c32
-rw-r--r--gcc/testsuite/c-c++-common/dfp/signbit-1.c40
-rw-r--r--gcc/testsuite/c-c++-common/dfp/signbit-2.c33
-rw-r--r--gcc/testsuite/c-c++-common/dfp/struct-layout-1.c71
-rw-r--r--gcc/testsuite/c-c++-common/dfp/usual-arith-conv-const.c32
-rw-r--r--gcc/testsuite/c-c++-common/dfp/usual-arith-conv.c117
-rw-r--r--gcc/testsuite/c-c++-common/dwarf2/pr43190.c13
-rw-r--r--gcc/testsuite/c-c++-common/dwarf2/vla1.c11
-rw-r--r--gcc/testsuite/c-c++-common/fmax-errors.c11
-rw-r--r--gcc/testsuite/c-c++-common/guality/pr43141.c16
-rw-r--r--gcc/testsuite/c-c++-common/int128-1.c41
-rw-r--r--gcc/testsuite/c-c++-common/int128-2.c157
-rw-r--r--gcc/testsuite/c-c++-common/int128-types-1.c666
-rw-r--r--gcc/testsuite/c-c++-common/pr20000.c32
-rw-r--r--gcc/testsuite/c-c++-common/pr33193.c19
-rw-r--r--gcc/testsuite/c-c++-common/pr33763.c60
-rw-r--r--gcc/testsuite/c-c++-common/pr36513-2.c13
-rw-r--r--gcc/testsuite/c-c++-common/pr36513.c15
-rw-r--r--gcc/testsuite/c-c++-common/pr41779.c56
-rw-r--r--gcc/testsuite/c-c++-common/pr41935.c70
-rw-r--r--gcc/testsuite/c-c++-common/pr42674.c13
-rw-r--r--gcc/testsuite/c-c++-common/pr43690.c13
-rw-r--r--gcc/testsuite/c-c++-common/pr43942.c33
-rw-r--r--gcc/testsuite/c-c++-common/pr44832.c161
-rw-r--r--gcc/testsuite/c-c++-common/pr51768.c25
-rw-r--r--gcc/testsuite/c-c++-common/pr52181.c13
-rw-r--r--gcc/testsuite/c-c++-common/pr54486.c32
-rw-r--r--gcc/testsuite/c-c++-common/raw-string-1.c141
-rw-r--r--gcc/testsuite/c-c++-common/raw-string-10.c20
-rw-r--r--gcc/testsuite/c-c++-common/raw-string-11.c13
-rw-r--r--gcc/testsuite/c-c++-common/raw-string-2.c125
-rw-r--r--gcc/testsuite/c-c++-common/raw-string-3.c59
-rw-r--r--gcc/testsuite/c-c++-common/raw-string-4.c29
-rw-r--r--gcc/testsuite/c-c++-common/raw-string-5.c27
-rw-r--r--gcc/testsuite/c-c++-common/raw-string-6.c6
-rw-r--r--gcc/testsuite/c-c++-common/raw-string-7.c24
-rw-r--r--gcc/testsuite/c-c++-common/raw-string-8.c10
-rw-r--r--gcc/testsuite/c-c++-common/raw-string-9.c19
-rw-r--r--gcc/testsuite/c-c++-common/restrict-1.c20
-rw-r--r--gcc/testsuite/c-c++-common/restrict-2.c14
-rw-r--r--gcc/testsuite/c-c++-common/restrict-4.c19
-rw-r--r--gcc/testsuite/c-c++-common/torture/complex-alias-1.c35
-rw-r--r--gcc/testsuite/c-c++-common/torture/complex-sign-add.c55
-rw-r--r--gcc/testsuite/c-c++-common/torture/complex-sign-mixed-add.c55
-rw-r--r--gcc/testsuite/c-c++-common/torture/complex-sign-mixed-div.c47
-rw-r--r--gcc/testsuite/c-c++-common/torture/complex-sign-mixed-mul.c55
-rw-r--r--gcc/testsuite/c-c++-common/torture/complex-sign-mixed-sub.c55
-rw-r--r--gcc/testsuite/c-c++-common/torture/complex-sign-mul-minus-one.c63
-rw-r--r--gcc/testsuite/c-c++-common/torture/complex-sign-mul-one.c63
-rw-r--r--gcc/testsuite/c-c++-common/torture/complex-sign-mul.c55
-rw-r--r--gcc/testsuite/c-c++-common/torture/complex-sign-sub.c55
-rw-r--r--gcc/testsuite/c-c++-common/torture/complex-sign.h80
-rw-r--r--gcc/testsuite/c-c++-common/torture/pr42834.c23
-rw-r--r--gcc/testsuite/c-c++-common/torture/pr46137.c18
-rw-r--r--gcc/testsuite/c-c++-common/uninit-17.c25
-rw-r--r--gcc/testsuite/c-c++-common/vla-1.c21
-rw-r--r--gcc/testsuite/c-c++-common/warn-ommitted-condop.c29
166 files changed, 10264 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/Wconversion-real.c b/gcc/testsuite/c-c++-common/Wconversion-real.c
new file mode 100644
index 000000000..464aab055
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wconversion-real.c
@@ -0,0 +1,85 @@
+/* Test for diagnostics for Wconversion for floating-point. */
+
+/* { dg-do compile } */
+/* { dg-skip-if "doubles are floats" { "avr-*-*" } { "*" } { "" } } */
+/* { dg-options "-std=c99 -Wconversion" { target c } } */
+/* { dg-options "-Wconversion" { target c++ } } */
+/* { dg-require-effective-target large_double } */
+
+float vfloat;
+double vdouble;
+long double vlongdouble;
+
+void ffloat (float f);
+void fdouble (double d);
+void flongdouble (long double ld);
+
+void h (void)
+{
+ float f = 0;
+ double d = 0;
+ long double ld = 0;
+
+ ffloat (3.1); /* { dg-warning "conversion" } */
+ vfloat = 3.1; /* { dg-warning "conversion" } */
+ ffloat (3.1L); /* { dg-warning "conversion" } */
+ vfloat = 3.1L; /* { dg-warning "conversion" } */
+ fdouble (3.1L); /* { dg-warning "conversion" "" { target large_long_double } } */
+ vdouble = 3.1L; /* { dg-warning "conversion" "" { target large_long_double } } */
+ ffloat (vdouble); /* { dg-warning "conversion" } */
+ vfloat = vdouble; /* { dg-warning "conversion" } */
+ ffloat (vlongdouble); /* { dg-warning "conversion" } */
+ vfloat = vlongdouble; /* { dg-warning "conversion" } */
+ fdouble (vlongdouble); /* { dg-warning "conversion" "" { target large_long_double } } */
+ vdouble = vlongdouble; /* { dg-warning "conversion" "" { target large_long_double } } */
+
+
+ ffloat ((float) 3.1);
+ vfloat = (float) 3.1;
+ ffloat ((float) 3.1L);
+ vfloat = (float) 3.1L;
+ fdouble ((double) 3.1L);
+ vdouble = (double) 3.1L;
+ ffloat ((float) vdouble);
+ vfloat = (float) vdouble;
+ ffloat ((float) vlongdouble);
+ vfloat = (float) vlongdouble;
+ fdouble ((double) vlongdouble);
+ vdouble = (double) vlongdouble;
+
+
+ ffloat (3.0);
+ vfloat = 3.0;
+ ffloat (3.1f);
+ vfloat = 3.1f;
+ ffloat (0.25L);
+ vfloat = 0.25L;
+
+
+ fdouble (3.0);
+ vdouble = 3.0;
+ fdouble (3.1f);
+ vdouble = 3.1f;
+ fdouble (0.25L);
+ vdouble = 0.25L;
+
+ flongdouble (3.0);
+ vlongdouble = 3.0;
+ flongdouble (3.1f);
+ vlongdouble = 3.1f;
+ flongdouble (0.25L);
+ vlongdouble = 0.25L;
+
+ ffloat (f);
+ vfloat = f;
+ fdouble (f);
+ vdouble = f;
+ fdouble (d);
+ vdouble = d;
+ flongdouble (f);
+ vlongdouble = f;
+ flongdouble (d);
+ vlongdouble = d;
+ flongdouble (ld);
+ vlongdouble = ld;
+}
diff --git a/gcc/testsuite/c-c++-common/Wint-to-pointer-cast-1.c b/gcc/testsuite/c-c++-common/Wint-to-pointer-cast-1.c
new file mode 100644
index 000000000..a7687a607
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wint-to-pointer-cast-1.c
@@ -0,0 +1,12 @@
+/* Test -Wint-to-pointer-cast - on by default. */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+char c;
+
+void *
+f (void)
+{
+ return (void *) c; /* { dg-warning "cast to pointer from integer of different size" } */
+}
diff --git a/gcc/testsuite/c-c++-common/Wint-to-pointer-cast-2.c b/gcc/testsuite/c-c++-common/Wint-to-pointer-cast-2.c
new file mode 100644
index 000000000..5546abb81
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wint-to-pointer-cast-2.c
@@ -0,0 +1,12 @@
+/* Test -Wint-to-pointer-cast. */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do compile } */
+/* { dg-options "-Wint-to-pointer-cast" } */
+
+char c;
+
+void *
+f (void)
+{
+ return (void *) c; /* { dg-warning "cast to pointer from integer of different size" } */
+}
diff --git a/gcc/testsuite/c-c++-common/Wint-to-pointer-cast-3.c b/gcc/testsuite/c-c++-common/Wint-to-pointer-cast-3.c
new file mode 100644
index 000000000..052ab3727
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wint-to-pointer-cast-3.c
@@ -0,0 +1,22 @@
+/* Test -Wno-int-to-pointer-cast. */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do compile } */
+/* { dg-options "-Wno-int-to-pointer-cast" } */
+
+char c;
+
+void *
+f (void)
+{
+ return (void *) c;
+}
+
+void *p;
+
+char
+g (void)
+{
+ return (char) p;
+/* { dg-warning "cast from pointer to integer of different size" "" { target c } 19 } */
+/* { dg-error "cast from 'void\\*' to 'char' loses precision" "" { target c++ } 19 } */
+}
diff --git a/gcc/testsuite/c-c++-common/Wunused-var-1.c b/gcc/testsuite/c-c++-common/Wunused-var-1.c
new file mode 100644
index 000000000..ef8f6d454
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-var-1.c
@@ -0,0 +1,179 @@
+/* { dg-do compile } */
+/* { dg-options "-Wunused" } */
+
+void
+f1 (void)
+{
+ int a; /* { dg-warning "set but not used" } */
+ int b;
+ int c;
+ c = 1;
+ a = b = c;
+}
+
+void
+f2 (int x)
+{
+ int a; /* { dg-warning "set but not used" } */
+ int b;
+ int c; /* { dg-warning "set but not used" } */
+ c = (a = x, b = x);
+}
+
+int
+f3 (int x)
+{
+ int a;
+ return a = x;
+}
+
+int
+f4 (int x)
+{
+ int a;
+ a = x;
+ return a;
+}
+
+void
+f5 (int x)
+{
+ int a[2]; /* { dg-warning "set but not used" } */
+ int b;
+ int *c, d[2];
+ c = d;
+ b = x;
+ a[b] = 1;
+ c[b] = 1;
+}
+
+int
+f6 (int x)
+{
+ int a[2];
+ int b;
+ b = x;
+ a[b] = 1;
+ return a[b];
+}
+
+void
+f7 (int x, int *p)
+{
+ int *a[2];
+ a[x] = p;
+ a[x][x] = x;
+}
+
+struct S { int i; };
+
+void
+f8 (void)
+{
+ struct S s; /* { dg-warning "set but not used" } */
+ s.i = 6;
+}
+
+int
+f9 (void)
+{
+ struct S s;
+ s.i = 6;
+ return s.i;
+}
+
+struct S
+f10 (void)
+{
+ struct S s;
+ s.i = 6;
+ return s;
+}
+
+extern int foo11 (int *);
+
+void
+f11 (void)
+{
+ int a[2];
+ foo11 (a);
+}
+
+void
+f12 (void)
+{
+ int a;
+ a = 1;
+ a; /* { dg-warning "no effect" } */
+}
+
+void
+f13 (void (*x) (void))
+{
+ void (*a) (void);
+ a = x;
+ a ();
+}
+
+void
+f14 (void (*x) (void))
+{
+ void (*a) (void); /* { dg-warning "set but not used" } */
+ a = x;
+}
+
+extern void foo15 (int *);
+
+void
+f15 (void)
+{
+ int a[10];
+ int *b = a + 2;
+ foo15 (b);
+}
+
+extern void foo16 (int **);
+
+void
+f16 (void)
+{
+ int a[10];
+ int *b[] = { a, a + 2 };
+ foo16 (b);
+}
+
+void
+f17 (int x)
+{
+ long a; /* { dg-warning "set but not used" } */
+ int b;
+ a = b = x;
+}
+
+void
+f18 (int x)
+{
+ int a; /* { dg-warning "set but not used" } */
+ int b;
+ a = (char) (b = x);
+}
+
+int
+f19 (int x, int y, int z)
+{
+ int a;
+ int b;
+ a = x;
+ b = y;
+ return z ? a : b;
+}
+
+int *
+f20 (int x)
+{
+ static int a[] = { 3, 4, 5, 6 };
+ static int b[] = { 4, 5, 6, 7 };
+ static int c[] = { 5, 6, 7, 8 }; /* { dg-warning "set but not used" } */
+ c[1] = 1;
+ return x ? a : b;
+}
diff --git a/gcc/testsuite/c-c++-common/Wunused-var-10.c b/gcc/testsuite/c-c++-common/Wunused-var-10.c
new file mode 100644
index 000000000..16d5171d0
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-var-10.c
@@ -0,0 +1,68 @@
+/* PR c++/44362 */
+/* { dg-options "-Wunused" } */
+/* { dg-do compile } */
+
+int
+f1 (int u, int v)
+{
+ int a, b, c, d, e, f, g, h, i;
+ a = u;
+ b = v;
+ c = u;
+ d = v;
+ e = u;
+ f = v;
+ g = u == 6 ? a : b;
+ h = 0 ? c : d;
+ i = 1 ? e : f;
+ return g + h + i;
+}
+
+int
+f2 (int u, int v)
+{
+ int a, b, c, d, e, f, g, h, i;
+ a = u;
+ b = v;
+ c = u;
+ d = v;
+ e = u;
+ f = v;
+ g = u == 6 ? a + 1 : b;
+ h = 0 ? c + 1 : d;
+ i = 1 ? e + 1 : f;
+ return g + h + i;
+}
+
+int
+f3 (int u, int v)
+{
+ int a, b, c, d, e, f, g, h, i;
+ a = u;
+ b = v;
+ c = u;
+ d = v;
+ e = u;
+ f = v;
+ g = u == 6 ? a : b + 1;
+ h = 0 ? c : d + 1;
+ i = 1 ? e : f + 1;
+ return g + h + i;
+}
+
+int
+f4 (int u, int v)
+{
+ int a, c, e, g, h, i;
+ long b, d, f;
+ a = u;
+ b = v;
+ c = u;
+ d = v;
+ e = u;
+ f = v;
+ g = u == 6 ? a : b;
+ h = 0 ? c : d;
+ i = 1 ? e : f;
+ return g + h + i;
+}
diff --git a/gcc/testsuite/c-c++-common/Wunused-var-11.c b/gcc/testsuite/c-c++-common/Wunused-var-11.c
new file mode 100644
index 000000000..a59ef8149
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-var-11.c
@@ -0,0 +1,12 @@
+/* PR c++/44443 */
+/* { dg-options "-Wunused" } */
+/* { dg-do compile } */
+
+int i;
+
+void
+f1 ()
+{
+ const int * __attribute__((unused)) a = &i;
+ const int *b __attribute__((unused)) = &i;
+}
diff --git a/gcc/testsuite/c-c++-common/Wunused-var-12.c b/gcc/testsuite/c-c++-common/Wunused-var-12.c
new file mode 100644
index 000000000..94e56d8a8
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-var-12.c
@@ -0,0 +1,26 @@
+/* PR c++/44780 */
+/* { dg-do compile } */
+/* { dg-options "-Wunused" } */
+/* { dg-options "-Wunused -fno-common" { target { { hppa*-*-hpux* } && { ! hppa*64*-*-* } } } } */
+
+typedef double vec __attribute__ ((__vector_size__ (16)));
+vec c, d;
+
+void
+foo (void)
+{
+ vec a;
+ vec b;
+ a = c;
+ b = a;
+ d = b;
+}
+
+void
+bar (void)
+{
+ vec a;
+ vec b; /* { dg-warning "set but not used" } */
+ a = c;
+ b = a;
+}
diff --git a/gcc/testsuite/c-c++-common/Wunused-var-13.c b/gcc/testsuite/c-c++-common/Wunused-var-13.c
new file mode 100644
index 000000000..3afd873b6
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-var-13.c
@@ -0,0 +1,27 @@
+/* PR c/46015 */
+/* { dg-options "-Wunused" } */
+/* { dg-do compile } */
+
+int
+f1 (int i)
+{
+ static void *labs[2] = { &&lab1, &&lab2 };
+ goto *(labs[i & 1]);
+
+lab1:
+ return 1;
+lab2:
+ return 2;
+}
+
+int
+f2 (int i)
+{
+ void *labs[2] = { &&lab1, &&lab2 };
+ goto *labs[i & 1];
+
+lab1:
+ return 1;
+lab2:
+ return 2;
+}
diff --git a/gcc/testsuite/c-c++-common/Wunused-var-14.c b/gcc/testsuite/c-c++-common/Wunused-var-14.c
new file mode 100644
index 000000000..389febae8
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-var-14.c
@@ -0,0 +1,13 @@
+/* PR c/50179 */
+/* { dg-options "-Wunused" } */
+/* { dg-do compile } */
+
+void bar (int, ...);
+
+char *
+foo (void)
+{
+ bar (1, (__extension__ ({ static char b[2]; b[0] = 1; b; })));
+ bar (1, ({ static char c[2]; c[0] = 1; c; }));
+ return ({ static char d[2]; d[0] = 1; d; });
+}
diff --git a/gcc/testsuite/c-c++-common/Wunused-var-2.c b/gcc/testsuite/c-c++-common/Wunused-var-2.c
new file mode 100644
index 000000000..281825900
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-var-2.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-Wunused" } */
+
+int
+f1 (void)
+{
+ int c = ({
+ int a;
+ a = 1;
+ a; });
+ return c;
+}
+
+void
+f2 (void)
+{
+ int f;
+ f = 0;
+ __asm__ __volatile__ ("" : "+r" (f));
+}
diff --git a/gcc/testsuite/c-c++-common/Wunused-var-3.c b/gcc/testsuite/c-c++-common/Wunused-var-3.c
new file mode 100644
index 000000000..9b1fce77a
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-var-3.c
@@ -0,0 +1,37 @@
+/* { dg-do compile } */
+/* { dg-options "-Wunused" } */
+
+void
+f1 (void)
+{
+ _Complex int a; /* { dg-warning "set but not used" } */
+ _Complex double b; /* { dg-warning "set but not used" } */
+ __real__ a = 1;
+ __imag__ a = 2;
+ __real__ b = 3.0;
+ __imag__ b = 4.0;
+}
+
+int
+f2 (void)
+{
+ _Complex int a;
+ _Complex double b;
+ __real__ a = 1;
+ __imag__ a = 2;
+ __real__ b = 3.0;
+ __imag__ b = 4.0;
+ return __real__ a + __imag__ b;
+}
+
+_Complex double
+f3 (void)
+{
+ _Complex int a;
+ _Complex double b;
+ __real__ a = 1;
+ __imag__ a = 2;
+ __real__ b = 3.0;
+ __imag__ b = 4.0;
+ return a + b;
+}
diff --git a/gcc/testsuite/c-c++-common/Wunused-var-4.c b/gcc/testsuite/c-c++-common/Wunused-var-4.c
new file mode 100644
index 000000000..d60c476a4
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-var-4.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-Wunused -W" } */
+
+int
+f1 (unsigned int x)
+{
+ int c = ({ union { unsigned int a; int b; } u; u.a = x; u.b; });
+ return c;
+}
+
+void
+f2 (void)
+{
+ struct S { int i; } a;
+ int b[1];
+ a.i = 1;
+ a.i; /* { dg-warning "no effect" } */
+ b[0] = 1;
+ b[0]; /* { dg-warning "no effect" } */
+}
+
+void
+f3 (void)
+{
+ struct S { int i; } a; /* { dg-warning "set but not used" } */
+ int b[1]; /* { dg-warning "set but not used" } */
+ a.i = 1;
+ b[0] = 1;
+}
diff --git a/gcc/testsuite/c-c++-common/Wunused-var-5.c b/gcc/testsuite/c-c++-common/Wunused-var-5.c
new file mode 100644
index 000000000..747f58d04
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-var-5.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-Wunused" } */
+
+void
+f1 (void)
+{
+ extern int extvari;
+ extvari = 1;
+}
+
+int extvarj;
+
+void
+f2 (void)
+{
+ extern int extvarj;
+ extvarj = 1;
+}
+
+static int extvark;
+
+void
+f3 (void)
+{
+ extern int extvark;
+ extvark = 1;
+}
+
+int
+f4 (void)
+{
+ return extvark;
+}
diff --git a/gcc/testsuite/c-c++-common/Wunused-var-6.c b/gcc/testsuite/c-c++-common/Wunused-var-6.c
new file mode 100644
index 000000000..1217719a2
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-var-6.c
@@ -0,0 +1,15 @@
+/* PR c/43981 */
+/* { dg-do compile } */
+/* { dg-options "-Wunused" } */
+
+void g (char *);
+
+char
+f (int a)
+{
+ int len = a * 3;
+ char t[len];
+
+ g (t);
+ return t[0];
+}
diff --git a/gcc/testsuite/c-c++-common/Wunused-var-7.c b/gcc/testsuite/c-c++-common/Wunused-var-7.c
new file mode 100644
index 000000000..74196436d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-var-7.c
@@ -0,0 +1,48 @@
+/* PR c++/44062 */
+/* { dg-do compile } */
+/* { dg-options "-Wunused" } */
+
+void
+foo (void)
+{
+ int a, b, c, d, e, f, g;
+ a = 1;
+ b = 2;
+ c = 3;
+ d = 4;
+ e = 5;
+ f = 6;
+ g = 7;
+ a; /* { dg-warning "no effect" } */
+ b, 1; /* { dg-warning "no effect" } */
+ (void) c;
+ (void) d, 1; /* { dg-warning "no effect" } */
+ e, f, 1; /* { dg-warning "no effect" } */
+ (void) g, f, 1; /* { dg-warning "no effect" } */
+}
+
+void
+bar (void)
+{
+ int a;
+ int b;
+ int c; /* { dg-warning "set but not used" } */
+ a = 1;
+ b = 2;
+ c = 3;
+ c = ({ a++, b; });
+}
+
+void
+baz (void)
+{
+ int a;
+ int b;
+ int c;
+ int d;
+ a = 1;
+ b = 2;
+ c = 3;
+ d = 4;
+ d, ( a++, b ), c; /* { dg-warning "no effect" } */
+}
diff --git a/gcc/testsuite/c-c++-common/Wunused-var-8.c b/gcc/testsuite/c-c++-common/Wunused-var-8.c
new file mode 100644
index 000000000..0923b3556
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-var-8.c
@@ -0,0 +1,19 @@
+/* Origin: PR c++/44108 */
+/* { dg-options "-Wunused" } */
+/* { dg-do compile } */
+
+int
+foo ()
+{
+ unsigned int M = 2;
+ const unsigned int M_CONST = 2;
+ static unsigned int M_STATIC = 2;
+ static const unsigned int M_STATIC_CONST = 2;
+
+ char n1[M];
+ char n2[M_CONST];
+ char n3[M_STATIC];
+ char n4[M_STATIC_CONST];
+
+ return sizeof (n1) + sizeof (n2) + sizeof (n3) + sizeof (n4);
+}
diff --git a/gcc/testsuite/c-c++-common/Wunused-var-9.c b/gcc/testsuite/c-c++-common/Wunused-var-9.c
new file mode 100644
index 000000000..b2cdc4510
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wunused-var-9.c
@@ -0,0 +1,80 @@
+/* { dg-options "-Wunused" } */
+/* { dg-do compile } */
+
+int f1 (int *, int);
+int f2 (int *);
+int f3 (int *);
+
+int
+f4 (int x)
+{
+ int a, n = 0;
+ int b;
+ for (a = f1 (&b, x); f2 (&b); (void) (a = f3 (&b)))
+ n++;
+ return n;
+}
+
+void
+f5 (int x)
+{
+ int a;
+ a = x;
+ (void) (a = x);
+}
+
+void
+f6 (int x)
+{
+ int a; /* { dg-warning "set but not used" } */
+ a = x;
+}
+
+void
+f7 (int x)
+{
+ int a;
+ ({ a = x; });
+}
+
+int
+f8 (int x)
+{
+ int a;
+ int b = ({ a = x; });
+ return b;
+}
+
+int v;
+
+void
+f9 (int x)
+{
+ int a;
+ ({ v++, a = x; });
+}
+
+int
+f10 (int x)
+{
+ int a;
+ int b = ({ v++, a = x; });
+ return b;
+}
+
+void
+f11 (int x)
+{
+ int a;
+ a = x;
+ ({ v++, a; });
+}
+
+int
+f12 (int x)
+{
+ int a;
+ a = x;
+ int b = ({ v++, a; });
+ return b;
+}
diff --git a/gcc/testsuite/c-c++-common/abi-bf.c b/gcc/testsuite/c-c++-common/abi-bf.c
new file mode 100644
index 000000000..05b898609
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/abi-bf.c
@@ -0,0 +1,3 @@
+/* { dg-warning "incompatible" } */
+/* { dg-do compile } */
+/* { dg-options "-fstrict-volatile-bitfields -fabi-version=1" } */
diff --git a/gcc/testsuite/c-c++-common/asmgoto-1.c b/gcc/testsuite/c-c++-common/asmgoto-1.c
new file mode 100644
index 000000000..9c729fdd5
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asmgoto-1.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+void
+foo (void)
+{
+ int i = 0;
+ asm ("" : : : "memory");
+ asm ("" : : : );
+ asm ("" : : "r" (i));
+ asm ("" : : );
+ asm ("" : "=r" (i));
+ asm ("" : );
+ asm ("");
+}
diff --git a/gcc/testsuite/c-c++-common/asmgoto-2.c b/gcc/testsuite/c-c++-common/asmgoto-2.c
new file mode 100644
index 000000000..5bf45725d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asmgoto-2.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+void
+foo (void)
+{
+ __label__ lab;
+ int i = 0;
+ asm goto ("" : : : : lab);
+ asm goto ("" : "=r" (i) : : : lab); /* { dg-error "expected" } */
+ asm goto ("" : : : : ); /* { dg-error "expected" } */
+ asm goto ("" : : : "memory"); /* { dg-error "expected" } */
+ asm goto ("" : : : ); /* { dg-error "expected" } */
+ asm goto ("" : : "r" (i)); /* { dg-error "expected" } */
+ asm goto ("" : : ); /* { dg-error "expected" } */
+ asm goto ("" : "=r" (i)); /* { dg-error "expected" } */
+ asm goto ("" : ); /* { dg-error "expected" } */
+ asm goto (""); /* { dg-error "expected" } */
+ lab:;
+}
diff --git a/gcc/testsuite/c-c++-common/asmgoto-3.c b/gcc/testsuite/c-c++-common/asmgoto-3.c
new file mode 100644
index 000000000..5224429a3
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asmgoto-3.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-Wunused" } */
+
+int foo ()
+{
+ asm goto ("" : : : : label);
+ return 1;
+ label:
+ return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/asmgoto-4.c b/gcc/testsuite/c-c++-common/asmgoto-4.c
new file mode 100644
index 000000000..4532bf196
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asmgoto-4.c
@@ -0,0 +1,44 @@
+/* PR middle-end/44071 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+static inline int
+f1 (void)
+{
+ asm goto ("" : : : : l1, l2);
+ __builtin_unreachable ();
+ l1:
+ return 1;
+ l2:
+ return 0;
+}
+
+int
+b1 (int x)
+{
+ if (f1 () || x == 6)
+ x = 1;
+ else
+ x = 2;
+ return x;
+}
+
+static inline int
+f2 (void)
+{
+ asm goto ("" : : : : l1, l2);
+ l1:
+ return 1;
+ l2:
+ return 0;
+}
+
+int
+b2 (int x)
+{
+ if (f2 () || x == 6)
+ x = 1;
+ else
+ x = 2;
+ return x;
+}
diff --git a/gcc/testsuite/c-c++-common/attr-used-2.c b/gcc/testsuite/c-c++-common/attr-used-2.c
new file mode 100644
index 000000000..f78b94b53
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/attr-used-2.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-Wall -O2" } */
+
+static int xyzzy __attribute__((__used__)) = 1;
+
+void foo()
+{
+ int x __attribute__((__used__)); /* { dg-warning "attribute ignored|unused variable" } */
+}
+
+/* { dg-final { scan-assembler "xyzzy" } } */
diff --git a/gcc/testsuite/c-c++-common/attr-used.c b/gcc/testsuite/c-c++-common/attr-used.c
new file mode 100644
index 000000000..ba7705aaa
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/attr-used.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+static void function_declaration_before(void) __attribute__((__used__));
+
+static void function_declaration_before(void) {}
+
+static void function_declaration_after(void) {}
+
+static void function_declaration_after(void) __attribute__((__used__));
+
+/* { dg-final { scan-assembler "function_declaration_before" } } */
+/* { dg-final { scan-assembler "function_declaration_after" } } */
diff --git a/gcc/testsuite/c-c++-common/builtin-offsetof.c b/gcc/testsuite/c-c++-common/builtin-offsetof.c
new file mode 100644
index 000000000..6d9777546
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/builtin-offsetof.c
@@ -0,0 +1,29 @@
+// Contributed by Dodji Seketeli <dodji@redhat.com>
+// Origin PR c++/38699
+// { dg-options "-Warray-bounds" }
+// { dg-do compile }
+
+struct A
+{
+ const char *p;
+};
+
+struct B
+{
+ char p[10];
+ struct A a;
+};
+
+void
+f0 ()
+{
+ __builtin_offsetof(struct A, p); // OK
+ __builtin_offsetof(struct A, p[0]); // { dg-error "non constant address" }
+ __builtin_offsetof(struct B, p[0]); // OK
+ __builtin_offsetof(struct B, p[9]); // OK
+ __builtin_offsetof(struct B, p[10]); // OK
+ __builtin_offsetof(struct B, p[11]); // { dg-warning "greater than size" }
+ __builtin_offsetof(struct B, a.p); // OK
+ __builtin_offsetof(struct B, p[0]); // OK
+ __builtin_offsetof(struct B, a.p[0]); // { dg-error "non constant address" }
+}
diff --git a/gcc/testsuite/c-c++-common/cpp/normalize-3.c b/gcc/testsuite/c-c++-common/cpp/normalize-3.c
new file mode 100644
index 000000000..ae0184cfb
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/normalize-3.c
@@ -0,0 +1,35 @@
+/* { dg-do preprocess } */
+/* { dg-options "-std=c99 -fextended-identifiers -Wnormalized=id" { target c } } */
+/* { dg-options "-fextended-identifiers -Wnormalized=id" { target c++ } } */
+
+\u00AA
+\u00B7
+\u0F43 /* { dg-warning "not in NFC" } */
+a\u05B8\u05B9\u05B9\u05BBb
+ a\u05BB\u05B9\u05B8\u05B9b /* { dg-warning "not in NFC" } */
+\u09CB
+\u09C7\u09BE /* { dg-warning "not in NFC" } */
+\u0B4B
+\u0B47\u0B3E /* { dg-warning "not in NFC" } */
+\u0BCA
+\u0BC6\u0BBE /* { dg-warning "not in NFC" } */
+\u0BCB
+\u0BC7\u0BBE /* { dg-warning "not in NFC" } */
+\u0CCA
+\u0CC6\u0CC2 /* { dg-warning "not in NFC" } */
+\u0D4A
+\u0D46\u0D3E /* { dg-warning "not in NFC" } */
+\u0D4B
+\u0D47\u0D3E /* { dg-warning "not in NFC" } */
+
+K
+\u212A
+
+\u03AC
+\u1F71 /* { dg-warning "not in NFC" } */
+
+\uAC00
+\u1100\u1161
+\uAC01
+\u1100\u1161\u11A8
+\uAC00\u11A8
diff --git a/gcc/testsuite/c-c++-common/cpp/pr45457.c b/gcc/testsuite/c-c++-common/cpp/pr45457.c
new file mode 100644
index 000000000..14879cd79
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/pr45457.c
@@ -0,0 +1,18 @@
+/* PR preprocessor/45457 */
+/* { dg-do compile } */
+
+const char *a =
+#ifdef __DBL_DENORM_MIN__
+"a"
+#endif
+#if defined(__DBL_EPSILON__)
+"b"
+#endif
+#ifndef __DBL_MAX__
+"c"
+#endif
+#if !defined(__DBL_MIN__)
+"d"
+#endif
+;
+double b = __DBL_DENORM_MIN__ + __DBL_EPSILON__ + __DBL_MAX__ + __DBL_MIN__;
diff --git a/gcc/testsuite/c-c++-common/cpp/warning-directive-1.c b/gcc/testsuite/c-c++-common/cpp/warning-directive-1.c
new file mode 100644
index 000000000..e23d240c2
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/warning-directive-1.c
@@ -0,0 +1,4 @@
+// { dg-do preprocess }
+// { dg-options "-std=gnu99 -fdiagnostics-show-option" { target c } }
+// { dg-options "-fdiagnostics-show-option" { target c++ } }
+#warning "Printed" // { dg-warning "\"Printed\" .-Wcpp." }
diff --git a/gcc/testsuite/c-c++-common/cpp/warning-directive-2.c b/gcc/testsuite/c-c++-common/cpp/warning-directive-2.c
new file mode 100644
index 000000000..65edd7bb9
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/warning-directive-2.c
@@ -0,0 +1,5 @@
+// { dg-do preprocess }
+// { dg-options "-std=gnu99 -fdiagnostics-show-option -Werror=cpp" { target c } }
+// { dg-options "-fdiagnostics-show-option -Werror=cpp" { target c++ } }
+/* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */
+#warning "Printed" // { dg-error "\"Printed\" .-Werror=cpp." }
diff --git a/gcc/testsuite/c-c++-common/cpp/warning-directive-3.c b/gcc/testsuite/c-c++-common/cpp/warning-directive-3.c
new file mode 100644
index 000000000..0c50a318d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/warning-directive-3.c
@@ -0,0 +1,4 @@
+// { dg-do preprocess }
+// { dg-options "-std=gnu99 -fdiagnostics-show-option -Werror -Wno-error=cpp" { target c } }
+// { dg-options "-fdiagnostics-show-option -Werror -Wno-error=cpp" { target c++ } }
+#warning "Printed" // { dg-warning "\"Printed\" .-Wcpp." }
diff --git a/gcc/testsuite/c-c++-common/cpp/warning-directive-4.c b/gcc/testsuite/c-c++-common/cpp/warning-directive-4.c
new file mode 100644
index 000000000..23069f8ad
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cpp/warning-directive-4.c
@@ -0,0 +1,4 @@
+// { dg-do preprocess }
+// { dg-options "-std=gnu99 -fdiagnostics-show-option -Wno-cpp" { target c } }
+// { dg-options "-fdiagnostics-show-option -Wno-cpp" { target c++ } }
+#warning "Not printed" // { dg-bogus "." }
diff --git a/gcc/testsuite/c-c++-common/dfp/call-by-value.c b/gcc/testsuite/c-c++-common/dfp/call-by-value.c
new file mode 100644
index 000000000..74aec53ae
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/call-by-value.c
@@ -0,0 +1,43 @@
+/* C99 6.9.1(9) Function definitions; parameter has automatic storage.
+
+ Test that actual parameters are passed by value and that modifications
+ made within functions are lost on function return. */
+
+#include "dfp-dbg.h"
+
+int foo32 (_Decimal32 z)
+{
+ z = z + 1.0df;
+}
+
+int foo64 (_Decimal64 z)
+{
+ z = z + 1.0dd;
+}
+
+int foo128 (_Decimal128 z)
+{
+ z = z + 1.0dl;
+}
+
+int
+main ()
+{
+ _Decimal32 d32 = 1.1df;
+ _Decimal64 d64 = 1.2dd;
+ _Decimal128 d128 = 1.3dl;
+
+ foo32 (d32);
+ if (d32 != 1.1df)
+ FAILURE
+
+ foo64 (d64);
+ if (d64 != 1.2dd)
+ FAILURE
+
+ foo128 (d128);
+ if (d128 != 1.3dl)
+ FAILURE
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/cast.c b/gcc/testsuite/c-c++-common/dfp/cast.c
new file mode 100644
index 000000000..b6585d70c
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/cast.c
@@ -0,0 +1,75 @@
+/* C99 6.5.4 Cast operators.
+ Test valid casts involving decimal float. */
+
+#include "dfp-dbg.h"
+
+_Decimal32 d32;
+_Decimal64 d64;
+_Decimal128 d128;
+
+static float f = 2.f;
+static double d = 2.l;
+
+int
+main (void)
+{
+ /* Casts between DFP types. */
+ d32 = 1.2df;
+ d64 = 1.2dd;
+ d128 = 1.2dl;
+
+ if (d32 != (_Decimal32) d64)
+ FAILURE
+ if (d32 != (_Decimal32) d128)
+ FAILURE
+
+ if (d64 != (_Decimal64) d32)
+ FAILURE
+ if (d64 != (_Decimal64) d128)
+ FAILURE
+
+ if (d128 != (_Decimal128) d32)
+ FAILURE
+ if (d128 != (_Decimal128) d64)
+ FAILURE
+
+ /* Casts between generic and decimal floating point types. Use a
+ value that we can assume can be represented exactly in all
+ representations. */
+
+ d32 = 2.0df;
+ d64 = 2.0dd;
+ d128 = 2.0dl;
+
+ /* To generic floating types. */
+ if ((float) d32 != 2.0f)
+ FAILURE
+ if ((double) d32 != 2.0l)
+ FAILURE
+ if ((float) d64 != 2.0f)
+ FAILURE
+ if ((double) d64 != 2.0l)
+ FAILURE
+ if ((float) d128 != 2.0f)
+ FAILURE
+ if ((double) d128 != 2.0l)
+ FAILURE
+
+ /* float to decimal floating types. */
+ if (d32 != (_Decimal32) f)
+ FAILURE
+ if (d64 != (_Decimal64) f)
+ FAILURE
+ if (d128 != (_Decimal128) f)
+ FAILURE
+
+ /* double to decimal floating types. */
+ if (d32 != (_Decimal32) d)
+ FAILURE
+ if (d64 != (_Decimal64) d)
+ FAILURE
+ if (d128 != (_Decimal128) d)
+ FAILURE
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/compare-eq-const.c b/gcc/testsuite/c-c++-common/dfp/compare-eq-const.c
new file mode 100644
index 000000000..0c9ff200b
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/compare-eq-const.c
@@ -0,0 +1,28 @@
+/* C99 6.5.9 Equality operators.
+ Compare decimal float constants against each other. */
+
+#include "dfp-dbg.h"
+
+extern void link_error (void);
+
+int
+main ()
+{
+ /* Compare like-typed positive constants. */
+ if (2.0df != 2.0df)
+ link_error ();
+
+ /* Compare decimal float constants of different types. */
+ if (500e-2dl != 0.05e2df)
+ link_error ();
+
+ /* Binary floating point introduces errors to decimal values. */
+ if (1.4 + 1.4 + 1.4 == 4.2)
+ link_error ();
+
+ /* But, this looks more like what one would expect. */
+ if (1.4dd + 1.4dd + 1.4dd != 4.2dd)
+ link_error ();
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/compare-eq-d128.c b/gcc/testsuite/c-c++-common/dfp/compare-eq-d128.c
new file mode 100644
index 000000000..79fcac319
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/compare-eq-d128.c
@@ -0,0 +1,14 @@
+/* { dg-options "-O0" } */
+
+/* C99 6.5.9 Equality operators.
+ Compare decimal float values against each other at runtime. */
+
+#define WIDTH 128
+#include "compare-eq.h"
+
+int main ()
+{
+ test_compares ();
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/compare-eq-d32.c b/gcc/testsuite/c-c++-common/dfp/compare-eq-d32.c
new file mode 100644
index 000000000..6b1a4c6d7
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/compare-eq-d32.c
@@ -0,0 +1,14 @@
+/* { dg-options "-O0" } */
+
+/* C99 6.5.9 Equality operators.
+ Compare decimal float values against each other at runtime. */
+
+#define WIDTH 32
+#include "compare-eq.h"
+
+int main ()
+{
+ test_compares ();
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/compare-eq-d64.c b/gcc/testsuite/c-c++-common/dfp/compare-eq-d64.c
new file mode 100644
index 000000000..f1b463ebe
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/compare-eq-d64.c
@@ -0,0 +1,14 @@
+/* { dg-options "-O0" } */
+
+/* C99 6.5.9 Equality operators.
+ Compare decimal float values against each other at runtime. */
+
+#define WIDTH 64
+#include "compare-eq.h"
+
+int main ()
+{
+ test_compares ();
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/compare-eq-dfp.c b/gcc/testsuite/c-c++-common/dfp/compare-eq-dfp.c
new file mode 100644
index 000000000..79a5691eb
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/compare-eq-dfp.c
@@ -0,0 +1,53 @@
+/* { dg-options "-O0" } */
+
+/* C99 6.5.9 Equality operators.
+ Compare decimal float values against variables of different types. */
+
+#include "dfp-dbg.h"
+
+_Decimal32 d32;
+_Decimal64 d64;
+_Decimal128 d128;
+
+/* Use some typedefs of decimal float types, too. */
+typedef _Decimal32 SDtype;
+typedef _Decimal64 DDtype;
+typedef _Decimal128 TDtype;
+
+SDtype d32b;
+DDtype d64b;
+TDtype d128b;
+
+void
+inits (void)
+{
+ d32 = 1.0df;
+ d64 = 3.0dd;
+ d128 = 5.0dl;
+ d32b = -1.0df;
+ d64b = -4.0dd;
+ d128b = -6.0dl;
+}
+
+void
+compare_dfp (void)
+{
+ if ((d32 == d64) != 0) FAILURE
+ if ((d32 != d128b) != 1) FAILURE
+
+ if ((d64 != d32) != 1) FAILURE
+ if ((d64 == d128) != 0) FAILURE
+
+ if ((d128 != d32) != 1) FAILURE
+ if ((d128 == d64) != 0) FAILURE
+}
+
+int
+main ()
+{
+ inits ();
+
+ compare_dfp ();
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/compare-eq.h b/gcc/testsuite/c-c++-common/dfp/compare-eq.h
new file mode 100644
index 000000000..830b3289b
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/compare-eq.h
@@ -0,0 +1,92 @@
+/* Basic test of runtime equality comparisons using simple values that
+ are not affected by rounding. */
+
+#include <stdlib.h>
+#include "dfp-dbg.h"
+
+#define PASTE2(A,B) A ## B
+#define PASTE(A,B) PASTE2(A,B)
+
+#undef FAILURE
+#ifdef DBG
+#define FAILURE(OP,KIND) \
+ { printf ("failed at line %d: %s for %s values\n", __LINE__, OP, KIND); \
+ failures++; }
+#else
+#define FAILURE(OP,KIND) __builtin_abort ();
+#endif
+
+#ifndef WIDTH
+#error define WIDTH as decimal float size in bytes
+#endif
+
+#if WIDTH == 32
+#define DTYPE _Decimal32
+#define SUFFIX DF
+#elif WIDTH == 64
+#define DTYPE _Decimal64
+#define SUFFIX DD
+#elif WIDTH == 128
+#define DTYPE _Decimal128
+#define SUFFIX DL
+#elif WIDTH == 0
+/* This is for testing the test using a type known to work. */
+#define DTYPE double
+#define SUFFIX
+#else
+#error invalid width for decimal float type
+#endif
+
+DTYPE m_two = PASTE(-2.0, SUFFIX);
+DTYPE m_one = PASTE(-1.0, SUFFIX);
+DTYPE zero = PASTE(0.0, SUFFIX);
+DTYPE one = PASTE(1.0, SUFFIX);
+DTYPE two = PASTE(2.0, SUFFIX);
+
+void
+test_compares (void)
+{
+ DTYPE x = one;
+ DTYPE y = zero;
+ DTYPE z = m_one;
+
+ /* Equal to: comparisons against equal values. */
+
+ if (! (x == one)) FAILURE ("==", "equal")
+ if (! (y == zero)) FAILURE ("==", "equal")
+ if (! (z == m_one)) FAILURE ("==", "equal")
+
+ /* Equal to: comparisons against lesser values. */
+
+ if (x == m_one) FAILURE ("==", "lesser")
+ if (x == zero) FAILURE ("==", "lesser")
+ if (y == m_one) FAILURE ("==", "lesser")
+ if (z == m_two) FAILURE ("==", "lesser")
+
+ /* Equal to: comparisons against greater values. */
+
+ if (x == two) FAILURE ("==", "greater")
+ if (y == one) FAILURE ("==", "greater")
+ if (z == zero) FAILURE ("==", "greater")
+ if (z == one) FAILURE ("==", "greater")
+
+ /* Not equal to: comparisons against equal values. */
+
+ if (x != one) FAILURE ("!=", "equal")
+ if (y != zero) FAILURE ("!=", "equal")
+ if (z != m_one) FAILURE ("!=", "equal")
+
+ /* Not equal to: comparisons against lesser values. */
+
+ if (! (x != m_one)) FAILURE ("!=", "lesser")
+ if (! (x != zero)) FAILURE ("!=", "lesser")
+ if (! (y != m_one)) FAILURE ("!=", "lesser")
+ if (! (z != m_two)) FAILURE ("!=", "lesser")
+
+ /* Not equal to: comparisons against greater values. */
+
+ if (! (x != m_one)) FAILURE ("!=", "greater")
+ if (! (x != zero)) FAILURE ("!=", "greater")
+ if (! (y != m_one)) FAILURE ("!=", "greater")
+ if (! (z != m_two)) FAILURE ("!=", "greater")
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/compare-rel-const.c b/gcc/testsuite/c-c++-common/dfp/compare-rel-const.c
new file mode 100644
index 000000000..8e99b4466
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/compare-rel-const.c
@@ -0,0 +1,57 @@
+/* C99 6.5.8 Relational operators.
+ Compare decimal float constants against each other. */
+
+extern void link_error (void);
+
+int
+main ()
+{
+ /* Compare like-typed negative constants. */
+ if (-2.0dl < -2.0dl)
+ link_error ();
+
+ /* Compare like-typed constants. */
+ if (-2.0dl >= .01dl)
+ link_error ();
+
+ /* Compare like-typed constants. */
+ if (0.2dd > 0.02e1dd)
+ link_error ();
+
+ /* Compare decimal float constants of different types. */
+ if (-.000005dd >= -.0000049DL)
+ link_error();
+
+ /* Test use gcc builtins for comparisons. */
+ if (__builtin_isless(-2.0dl,-2.0dl))
+ link_error();
+
+ if (__builtin_isgreaterequal(-2.0dl,.01dl))
+ link_error();
+
+ if (!(__builtin_islessequal(-2.0dl, -2.0dd)))
+ link_error();
+
+ if (!(__builtin_isgreater(2.0dl, -2.0dd)))
+ link_error();
+
+ if (__builtin_islessequal(2.0df, __builtin_nand64("")))
+ link_error();
+
+ if (__builtin_islessgreater(2.0dd, __builtin_nand64("")))
+ link_error();
+
+ if (!__builtin_islessgreater(2.0dd, -2.0dd))
+ link_error();
+
+ if (!__builtin_islessgreater(-3.0dd, 2.0dd))
+ link_error();
+
+ if (__builtin_isunordered(1.1df, 0.003dd))
+ link_error();
+
+ if (!__builtin_isunordered(-3.1df, __builtin_nand32("")))
+ link_error();
+
+ return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/compare-rel-d128.c b/gcc/testsuite/c-c++-common/dfp/compare-rel-d128.c
new file mode 100644
index 000000000..38c931a02
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/compare-rel-d128.c
@@ -0,0 +1,14 @@
+/* { dg-options "-O0" } */
+
+/* C99 6.5.8 Relational operators.
+ Compare decimal float values against each other at runtime. */
+
+#define WIDTH 128
+#include "compare-rel.h"
+
+int
+main ()
+{
+ test_compares ();
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/compare-rel-d32.c b/gcc/testsuite/c-c++-common/dfp/compare-rel-d32.c
new file mode 100644
index 000000000..04128aab9
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/compare-rel-d32.c
@@ -0,0 +1,14 @@
+/* { dg-options "-O0" } */
+
+/* C99 6.5.8 Relational operators.
+ Compare decimal float values against each other at runtime. */
+
+#define WIDTH 32
+#include "compare-rel.h"
+
+int
+main ()
+{
+ test_compares ();
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/compare-rel-d64.c b/gcc/testsuite/c-c++-common/dfp/compare-rel-d64.c
new file mode 100644
index 000000000..92f904a81
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/compare-rel-d64.c
@@ -0,0 +1,14 @@
+/* { dg-options "-O0" } */
+
+/* C99 6.5.8 Relational operators.
+ Compare decimal float values against each other at runtime. */
+
+#define WIDTH 64
+#include "compare-rel.h"
+
+int
+main ()
+{
+ test_compares ();
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/compare-rel-dfp.c b/gcc/testsuite/c-c++-common/dfp/compare-rel-dfp.c
new file mode 100644
index 000000000..59cc20353
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/compare-rel-dfp.c
@@ -0,0 +1,53 @@
+/* { dg-options "-O0" } */
+
+/* C99 6.5.8 Relational operators.
+ Compare decimal float values against variables of different types. */
+
+#include "dfp-dbg.h"
+
+_Decimal32 d32;
+_Decimal64 d64;
+_Decimal128 d128;
+
+/* Use some typedefs of decimal float types, too. */
+typedef _Decimal32 SDtype;
+typedef _Decimal64 DDtype;
+typedef _Decimal128 TDtype;
+
+SDtype d32b;
+DDtype d64b;
+TDtype d128b;
+
+void
+inits (void)
+{
+ d32 = 1.0df;
+ d64 = 3.0dd;
+ d128 = 5.0dl;
+ d32b = -1.0df;
+ d64b = -4.0dd;
+ d128b = -6.0dl;
+}
+
+void
+compare_dfp (void)
+{
+ if ((d32 > d64) != 0) FAILURE
+ if ((d32 >= d128b) != 1) FAILURE
+
+ if ((d64 < d32) != 0) FAILURE
+ if ((d64 <= d128) != 1) FAILURE
+
+ if ((d128 > d32) != 1) FAILURE
+ if ((d128 >= d64) != 1) FAILURE
+}
+
+int
+main ()
+{
+ inits ();
+
+ compare_dfp ();
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/compare-rel.h b/gcc/testsuite/c-c++-common/dfp/compare-rel.h
new file mode 100644
index 000000000..784010814
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/compare-rel.h
@@ -0,0 +1,132 @@
+/* Basic test of runtime relational comparisons using simple values that
+ are not affected by rounding. */
+
+#include <stdlib.h>
+#include "dfp-dbg.h"
+
+#undef FAILURE
+#ifdef DBG
+#define FAILURE(OP,KIND) \
+ { printf ("failed at line %d: %s for %s values\n", __LINE__, OP, KIND); \
+ failures++; }
+#else
+#define FAILURE(OP,KIND) __builtin_abort ();
+#endif
+
+#define PASTE2(A,B) A ## B
+#define PASTE(A,B) PASTE2(A,B)
+
+#ifndef WIDTH
+#error define WIDTH as decimal float size in bytes
+#endif
+
+#if WIDTH == 32
+#define DTYPE _Decimal32
+#define SUFFIX DF
+#elif WIDTH == 64
+#define DTYPE _Decimal64
+#define SUFFIX DD
+#elif WIDTH == 128
+#define DTYPE _Decimal128
+#define SUFFIX DL
+#elif WIDTH == 0
+/* This is for testing the test using a type known to work. */
+#define DTYPE double
+#define SUFFIX
+#else
+#error invalid width for decimal float type
+#endif
+
+DTYPE m_two = PASTE(-2.0, SUFFIX);
+DTYPE m_one = PASTE(-1.0, SUFFIX);
+DTYPE zero = PASTE(0.0, SUFFIX);
+DTYPE one = PASTE(1.0, SUFFIX);
+DTYPE two = PASTE(2.0, SUFFIX);
+
+void
+test_compares (void)
+{
+ DTYPE x = one;
+ DTYPE y = zero;
+ DTYPE z = m_one;
+
+ /* Less than or equal to: comparisons against equal values. */
+
+ if (! (x <= one)) FAILURE ("<=", "equal")
+ if (! (y <= zero)) FAILURE ("<=", "equal")
+ if (! (z <= m_one)) FAILURE ("<=", "equal")
+
+ /* Less than or equal to: comparisons against lesser values. */
+
+ if (x <= m_one) FAILURE ("<=", "lesser")
+ if (x <= zero) FAILURE ("<=", "lesser")
+ if (y <= m_one) FAILURE ("<=", "lesser")
+ if (z <= m_two) FAILURE ("<=", "lesser")
+
+ /* Less than or equal to: comparisons against greater values. */
+
+ if (! (x <= two)) FAILURE ("<=", "greater")
+ if (! (y <= one)) FAILURE ("<=", "greater")
+ if (! (z <= zero)) FAILURE ("<=", "greater")
+ if (! (z <= one)) FAILURE ("<=", "greater")
+
+ /* Less than: comparisons against equal values. */
+
+ if (x < one) FAILURE ("<", "equal")
+ if (y < zero) FAILURE ("<", "equal")
+ if (z < m_one) FAILURE ("<", "equal")
+
+ /* Less than: comparisons against lesser values. */
+
+ if (x < m_one) FAILURE ("<", "lesser")
+ if (x < zero) FAILURE ("<", "lesser")
+ if (y < m_one) FAILURE ("<", "lesser")
+ if (z < m_two) FAILURE ("<", "lesser")
+
+ /* Less than: comparisons against greater values. */
+
+ if (! (x < two)) FAILURE ("<", "greater")
+ if (! (y < one)) FAILURE ("<", "greater")
+ if (! (z < zero)) FAILURE ("<", "greater")
+ if (! (z < one)) FAILURE ("<", "greater")
+
+ /* Greater than or equal to: comparisons against equal values. */
+
+ if (! (x >= one)) FAILURE (">=", "equal")
+ if (! (y >= zero)) FAILURE (">=", "equal")
+ if (! (z >= m_one)) FAILURE (">=", "equal")
+
+ /* Greater than or equal to: comparisons against lesser values. */
+
+ if (! (x >= m_one)) FAILURE (">=", "lesser")
+ if (! (x >= zero)) FAILURE (">=", "lesser")
+ if (! (y >= m_one)) FAILURE (">=", "lesser")
+ if (! (z >= m_two)) FAILURE (">=", "lesser")
+
+ /* Greater than or equal to: comparisons against greater values. */
+
+ if (x >= two) FAILURE (">=", "greater")
+ if (y >= one) FAILURE (">=", "greater")
+ if (z >= zero) FAILURE (">=", "greater")
+ if (z >= one) FAILURE (">=", "greater")
+
+ /* Greater than: comparisons against equal values. */
+
+ if (x > one) FAILURE (">", "equal")
+ if (y > zero) FAILURE (">", "equal")
+ if (z > m_one) FAILURE (">", "equal")
+
+ /* Greater than: comparisons against lesser values. */
+
+ if (! (x > m_one)) FAILURE (">", "lesser")
+ if (! (x > zero)) FAILURE (">", "lesser")
+ if (! (y > m_one)) FAILURE (">", "lesser")
+ if (! (z > m_two)) FAILURE (">", "lesser")
+
+ /* Greater than: comparisons against greater values. */
+
+ if (x > two) FAILURE (">", "greater")
+ if (y > one) FAILURE (">", "greater")
+ if (z > zero) FAILURE (">", "greater")
+ if (z > one) FAILURE (">", "greater")
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/compare-special-d128.c b/gcc/testsuite/c-c++-common/dfp/compare-special-d128.c
new file mode 100644
index 000000000..d1f5bc5ed
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/compare-special-d128.c
@@ -0,0 +1,15 @@
+/* { dg-options "-O0" } */
+
+/* C99 6.5.8 Relational operators.
+ C99 6.5.9 Equality operators.
+ Compare decimal float special values at runtime. */
+
+#define WIDTH 128
+#include "compare-special.h"
+
+int
+main ()
+{
+ test_compares ();
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/compare-special-d32.c b/gcc/testsuite/c-c++-common/dfp/compare-special-d32.c
new file mode 100644
index 000000000..377c65a5b
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/compare-special-d32.c
@@ -0,0 +1,15 @@
+/* { dg-options "-O0" } */
+
+/* C99 6.5.8 Relational operators.
+ C99 6.5.9 Equality operators.
+ Compare decimal float special values at runtime. */
+
+#define WIDTH 32
+#include "compare-special.h"
+
+int
+main ()
+{
+ test_compares ();
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/compare-special-d64.c b/gcc/testsuite/c-c++-common/dfp/compare-special-d64.c
new file mode 100644
index 000000000..16154eff3
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/compare-special-d64.c
@@ -0,0 +1,15 @@
+/* { dg-options "-O0" } */
+
+/* C99 6.5.8 Relational operators.
+ C99 6.5.9 Equality operators.
+ Compare decimal float special values at runtime. */
+
+#define WIDTH 64
+#include "compare-special.h"
+
+int
+main ()
+{
+ test_compares ();
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/compare-special.h b/gcc/testsuite/c-c++-common/dfp/compare-special.h
new file mode 100644
index 000000000..9c27d126c
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/compare-special.h
@@ -0,0 +1,284 @@
+/* Basic test of runtime relational comparisons using NaNs and infinities. */
+
+#include <stdlib.h>
+#include "dfp-dbg.h"
+
+#define PASTE2(A,B) A ## B
+#define PASTE(A,B) PASTE2(A,B)
+
+/* Override FAILURE from dfp-dbg.h with one that provides additional info. */
+#undef FAILURE
+#ifdef DBG
+#define FAILURE(OP,KIND) \
+ { printf ("failed at line %d: %s for %s values\n", __LINE__, OP, KIND); \
+ failures++; }
+#else
+#define FAILURE(OP,KIND) __builtin_abort ();
+#endif
+
+#ifndef WIDTH
+#error define WIDTH as decimal float size in bytes
+#endif
+
+#if WIDTH == 32
+#define DTYPE _Decimal32
+#define SUFFIX DF
+#define SUFFIX2 d32
+#elif WIDTH == 64
+#define DTYPE _Decimal64
+#define SUFFIX DD
+#define SUFFIX2 d64
+#elif WIDTH == 128
+#define DTYPE _Decimal128
+#define SUFFIX DL
+#define SUFFIX2 d128
+#elif WIDTH == 0
+/* This is for testing the test using a type known to work. */
+#define DTYPE double
+#define SUFFIX
+#define SUFFIX2
+#else
+#error invalid width for decimal float type
+#endif
+
+DTYPE m_two = PASTE(-2.0, SUFFIX);
+DTYPE m_one = PASTE(-1.0, SUFFIX);
+DTYPE zero = PASTE(0.0, SUFFIX);
+DTYPE one = PASTE(1.0, SUFFIX);
+DTYPE two = PASTE(2.0, SUFFIX);
+
+volatile DTYPE x, y, z, _nan, inf, m_inf;
+
+void
+test_compares (void)
+{
+ _nan = PASTE(__builtin_nan, SUFFIX2) ("");
+ inf = PASTE(__builtin_inf, SUFFIX2) ();
+ m_inf = - PASTE(__builtin_inf, SUFFIX2) ();
+
+ x = PASTE(__builtin_nan, SUFFIX2) ("");
+ y = PASTE(__builtin_inf, SUFFIX2) ();
+ z = - PASTE(__builtin_inf, SUFFIX2) ();
+
+ /* Less than or equal to with NaN. */
+
+ if (x <= two) FAILURE ("<=", "NaN")
+ if (x <= zero) FAILURE ("<=", "NaN")
+ if (x <= m_one) FAILURE ("<=", "NaN")
+ if (x <= _nan) FAILURE ("<=", "NaN")
+ if (x <= inf) FAILURE ("<=", "NaN")
+ if (x <= m_inf) FAILURE ("<=", "NaN")
+
+ if (two <= x) FAILURE ("<=", "NaN")
+ if (zero <= x) FAILURE ("<=", "NaN")
+ if (m_one <= x) FAILURE ("<=", "NaN")
+ if (_nan <= x) FAILURE ("<=", "NaN")
+ if (inf <= x) FAILURE ("<=", "NaN")
+ if (m_inf <= x) FAILURE ("<=", "NaN")
+
+ /* Less than or equal to with infinities, no NaNs. */
+
+ if (y <= two) FAILURE ("<=", "inf")
+ if (y <= zero) FAILURE ("<=", "inf")
+ if (y <= m_one) FAILURE ("<=", "inf")
+ if (!(two <= y)) FAILURE ("<=", "inf")
+ if (!(zero <= y)) FAILURE ("<=", "inf")
+ if (!(m_one <= y)) FAILURE ("<=", "inf")
+
+ if (!(z <= two)) FAILURE ("<=", "-inf")
+ if (!(z <= zero)) FAILURE ("<=", "-inf")
+ if (!(z <= m_one)) FAILURE ("<=", "-inf")
+ if (two <= z) FAILURE ("<=", "-inf")
+ if (zero <= z) FAILURE ("<=", "-inf")
+ if (m_one <= z) FAILURE ("<=", "-inf")
+
+ if (!(y <= inf)) FAILURE ("<=", "inf")
+ if (y <= m_inf) FAILURE ("<=", "inf")
+ if (!(z <= inf)) FAILURE ("<=", "inf")
+ if (!(z <= m_inf)) FAILURE ("<=", "inf")
+
+ /* Less than with NaN. */
+
+ if (x < two) FAILURE ("<", "NaN")
+ if (x < zero) FAILURE ("<", "NaN")
+ if (x < m_one) FAILURE ("<", "NaN")
+ if (x < _nan) FAILURE ("<", "NaN")
+ if (x < inf) FAILURE ("<", "NaN")
+ if (x < m_inf) FAILURE ("<", "NaN")
+
+ if (two < x) FAILURE ("<", "NaN")
+ if (zero < x) FAILURE ("<", "NaN")
+ if (m_one < x) FAILURE ("<", "NaN")
+ if (_nan < x) FAILURE ("<", "NaN")
+ if (inf < x) FAILURE ("<", "NaN")
+ if (m_inf < x) FAILURE ("<", "NaN")
+
+ /* Less than with infinities, no NaNs. */
+
+ if (y < two) FAILURE ("<", "inf")
+ if (y < zero) FAILURE ("<", "inf")
+ if (y < m_one) FAILURE ("<", "inf")
+ if (!(two < y)) FAILURE ("<", "inf")
+ if (!(zero < y)) FAILURE ("<", "inf")
+ if (!(m_one < y)) FAILURE ("<", "inf")
+
+ if (!(z < two)) FAILURE ("<", "-inf")
+ if (!(z < zero)) FAILURE ("<", "-inf")
+ if (!(z < m_one)) FAILURE ("<", "-inf")
+ if (two < z) FAILURE ("<", "-inf")
+ if (zero < z) FAILURE ("<", "-inf")
+ if (m_one < z) FAILURE ("<", "-inf")
+
+ if (y < inf) FAILURE ("<=", "inf")
+ if (y < m_inf) FAILURE ("<=", "inf")
+ if (!(z < inf)) FAILURE ("<=", "inf")
+ if (z < m_inf) FAILURE ("<=", "inf")
+
+ /* Greater than or equal to with NaN. */
+
+ if (x >= two) FAILURE (">=", "NaN")
+ if (x >= zero) FAILURE (">=", "NaN")
+ if (x >= m_one) FAILURE (">=", "NaN")
+ if (x >= _nan) FAILURE (">=", "NaN")
+ if (x >= inf) FAILURE (">=", "NaN")
+ if (x >= m_inf) FAILURE (">=", "NaN")
+
+ if (two >= x) FAILURE (">=", "NaN")
+ if (zero >= x) FAILURE (">=", "NaN")
+ if (m_one >= x) FAILURE (">=", "NaN")
+ if (_nan >= x) FAILURE (">=", "NaN")
+ if (inf >= x) FAILURE (">=", "NaN")
+ if (m_inf >= x) FAILURE (">=", "NaN")
+
+ /* Greater than or equal to with infinities, no NaNs. */
+
+ if (!(y >= two)) FAILURE (">=", "inf")
+ if (!(y >= zero)) FAILURE (">=", "inf")
+ if (!(y >= m_one)) FAILURE (">=", "inf")
+ if (two >= y) FAILURE (">=", "inf")
+ if (zero >= y) FAILURE (">=", "inf")
+ if (m_one >= y) FAILURE (">=", "inf")
+
+ if (z >= two) FAILURE (">=", "-inf")
+ if (z >= zero) FAILURE (">=", "-inf")
+ if (z >= m_one) FAILURE (">=", "-inf")
+ if (!(two >= z)) FAILURE (">=", "-inf")
+ if (!(zero >= z)) FAILURE (">=", "-inf")
+ if (!(m_one >= z)) FAILURE (">=", "-inf")
+
+ if (!(y >= inf)) FAILURE ("<=", "inf")
+ if (!(y >= m_inf)) FAILURE ("<=", "inf")
+ if (z >= inf) FAILURE ("<=", "inf")
+ if (!(z >= m_inf)) FAILURE ("<=", "inf")
+
+ /* Greater than with NaN. */
+
+ if (x > two) FAILURE (">", "NaN")
+ if (x > zero) FAILURE (">", "NaN")
+ if (x > m_one) FAILURE (">", "NaN")
+ if (x > _nan) FAILURE (">", "NaN")
+ if (x > inf) FAILURE (">", "NaN")
+ if (x > m_inf) FAILURE (">", "NaN")
+
+ if (two > x) FAILURE (">", "NaN")
+ if (zero > x) FAILURE (">", "NaN")
+ if (m_one > x) FAILURE (">", "NaN")
+ if (_nan > x) FAILURE (">", "NaN")
+ if (inf > x) FAILURE (">", "NaN")
+ if (m_inf > x) FAILURE (">", "NaN")
+
+ /* Greater than with infinities, no NaNs. */
+
+ if (!(y > two)) FAILURE (">", "inf")
+ if (!(y > zero)) FAILURE (">", "inf")
+ if (!(y > m_one)) FAILURE (">", "inf")
+ if (two > y) FAILURE (">", "inf")
+ if (zero > y) FAILURE (">", "inf")
+ if (m_one > y) FAILURE (">", "inf")
+
+ if (z > two) FAILURE (">", "-inf")
+ if (z > zero) FAILURE (">", "-inf")
+ if (z > m_one) FAILURE (">", "-inf")
+ if (!(two > z)) FAILURE (">", "-inf")
+ if (!(zero > z)) FAILURE (">", "-inf")
+ if (!(m_one > z)) FAILURE (">", "-inf")
+
+ if (y > inf) FAILURE (">", "inf")
+ if (!(y > m_inf)) FAILURE (">", "inf")
+ if (z > inf) FAILURE (">", "inf")
+ if (z > m_inf) FAILURE (">", "inf")
+
+ /* Equal with NaN. */
+
+ if (x == two) FAILURE ("==", "NaN")
+ if (x == zero) FAILURE ("==", "NaN")
+ if (x == m_one) FAILURE ("==", "NaN")
+ if (x == _nan) FAILURE ("==", "NaN")
+ if (x == inf) FAILURE ("==", "NaN")
+ if (x == m_inf) FAILURE ("==", "NaN")
+
+ if (two == x) FAILURE ("==", "NaN")
+ if (zero == x) FAILURE ("==", "NaN")
+ if (m_one == x) FAILURE ("==", "NaN")
+ if (_nan == x) FAILURE ("==", "NaN")
+ if (inf == x) FAILURE ("==", "NaN")
+ if (m_inf == x) FAILURE ("==", "NaN")
+
+ /* Equal with infinities, no NaNs. */
+
+ if (y == two) FAILURE ("==", "inf")
+ if (y == zero) FAILURE ("==", "inf")
+ if (y == m_one) FAILURE ("==", "inf")
+ if (two == y) FAILURE ("==", "inf")
+ if (zero == y) FAILURE ("==", "inf")
+ if (m_one == y) FAILURE ("==", "inf")
+
+ if (z == two) FAILURE ("==", "-inf")
+ if (z == zero) FAILURE ("==", "-inf")
+ if (z == m_one) FAILURE ("==", "-inf")
+ if (two == z) FAILURE ("==", "-inf")
+ if (zero == z) FAILURE ("==", "-inf")
+ if (m_one == z) FAILURE ("==", "-inf")
+
+ if (!(y == inf)) FAILURE ("==", "inf")
+ if (y == m_inf) FAILURE ("==", "inf")
+ if (z == inf) FAILURE ("==", "inf")
+ if (!(z == m_inf)) FAILURE ("==", "inf")
+
+ /* Not equal with NaN. */
+
+ if (!(x != two)) FAILURE ("!=", "NaN")
+ if (!(x != zero)) FAILURE ("!=", "NaN")
+ if (!(x != m_one)) FAILURE ("!=", "NaN")
+ if (!(x != _nan)) FAILURE ("!=", "NaN")
+ if (!(x != inf)) FAILURE ("!=", "NaN")
+ if (!(x != m_inf)) FAILURE ("!=", "NaN")
+
+ if (!(two != x)) FAILURE ("!=", "NaN")
+ if (!(zero != x)) FAILURE ("!=", "NaN")
+ if (!(m_one != x)) FAILURE ("!=", "NaN")
+ if (!(_nan != x)) FAILURE ("!=", "NaN")
+ if (!(inf != x)) FAILURE ("!=", "NaN")
+ if (!(m_inf != x)) FAILURE ("!=", "NaN")
+
+ /* Not equal with infinities, no NaNs. */
+
+ if (!(y != two)) FAILURE ("!=", "inf")
+ if (!(y != zero)) FAILURE ("!=", "inf")
+ if (!(y != m_one)) FAILURE ("!=", "inf")
+ if (!(two != y)) FAILURE ("!=", "inf")
+ if (!(zero != y)) FAILURE ("!=", "inf")
+ if (!(m_one != y)) FAILURE ("!=", "inf")
+
+ if (!(z != two)) FAILURE ("!=", "-inf")
+ if (!(z != zero)) FAILURE ("!=", "-inf")
+ if (!(z != m_one)) FAILURE ("!=", "-inf")
+ if (!(two != z)) FAILURE ("!=", "-inf")
+ if (!(zero != z)) FAILURE ("!=", "-inf")
+ if (!(m_one != z)) FAILURE ("!=", "-inf")
+
+ if (y != inf) FAILURE ("!=", "inf")
+ if (!(y != m_inf)) FAILURE ("!=", "inf")
+ if (!(z != inf)) FAILURE ("!=", "inf")
+ if (z != m_inf) FAILURE ("!=", "inf")
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/constants-zero.c b/gcc/testsuite/c-c++-common/dfp/constants-zero.c
new file mode 100644
index 000000000..64b0054d2
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/constants-zero.c
@@ -0,0 +1,159 @@
+/* { dg-options "-O0" } */
+
+/* Decimal float values can have significant trailing zeroes. This is
+ true for zero values as well. Check that various representations of
+ zero are handled correctly when specified as literal constants. */
+
+#include "dfp-dbg.h"
+
+int big_endian;
+
+typedef union U32 {
+ unsigned int i;
+ _Decimal32 d;
+ unsigned char b[4];
+} u32_t;
+
+typedef union U64 {
+ unsigned long long i;
+ _Decimal64 d;
+} u64_t;
+
+typedef union U128 {
+ unsigned long long i[2];
+ _Decimal128 d;
+} u128_t;
+
+int
+compare32 (_Decimal32 d, unsigned int i)
+{
+ u32_t u;
+
+ u.d = d;
+ return (u.i == i);
+}
+
+int
+compare64 (_Decimal64 d, unsigned long long i)
+{
+ u64_t u;
+
+ u.d = d;
+ return (u.i == i);
+}
+
+int
+compare128 (_Decimal64 d, unsigned long long i, unsigned long long j)
+{
+ u128_t u;
+
+ u.d = d;
+ if (big_endian)
+ return (u.i[0] == i && u.i[1] == j);
+ else
+ return (u.i[1] == i && u.i[0] == j);
+}
+
+void
+dpd_tests (void)
+{
+ if (! compare32 (0.DF, 0x22500000U))
+ FAILURE
+ if (! compare32 (-0.DF, 0xa2500000U))
+ FAILURE
+ if (! compare32 (0.E-4DF, 0x22100000U))
+ FAILURE
+ if (! compare32 (0.E-7DF, 0x21e00000U))
+ FAILURE
+ if (! compare32 (0.E+3DF, 0x22800000U))
+ FAILURE
+
+ if (! compare64 (0.DD, 0x2238000000000000ULL))
+ FAILURE
+ if (! compare64 (-0.DD, 0xa238000000000000ULL))
+ FAILURE
+ if (! compare64 (0.E-6DD, 0x2220000000000000ULL))
+ FAILURE
+ if (! compare64 (0.E-7DD, 0x221c000000000000ULL))
+ FAILURE
+ if (! compare64 (0.E+2DD, 0x2240000000000000ULL))
+ FAILURE
+
+ if (! compare128 (0.DL, 0x2208000000000000ULL, 0x0000000000000000ULL))
+ FAILURE
+ if (! compare128 (-0.DL, 0xa208000000000000ULL, 0x0000000000000000ULL))
+ FAILURE
+ if (! compare128 (0.E-3DL, 0x2207400000000000ULL, 0x0000000000000000ULL))
+ FAILURE
+ if (! compare128 (0.E-8DL, 0x2206000000000000ULL, 0x0000000000000000ULL))
+ FAILURE
+ if (! compare128 (0.E+2DL, 0x2208800000000000ULL, 0x0000000000000000ULL))
+ FAILURE
+}
+
+void
+bid_tests (void)
+{
+ if (! compare32 (0.DF, 0x32800000U))
+ FAILURE
+ if (! compare32 (-0.DF, 0xb2800000U))
+ FAILURE
+ if (! compare32 (0.E-4DF, 0x30800000U))
+ FAILURE
+ if (! compare32 (0.E-7DF, 0x2f000000U))
+ FAILURE
+ if (! compare32 (0.E+3DF, 0x34000000U))
+ FAILURE
+
+ if (! compare64 (0.DD, 0x31c0000000000000ULL))
+ FAILURE
+ if (! compare64 (-0.DD, 0xb1c0000000000000ULL))
+ FAILURE
+ if (! compare64 (0.E-6DD, 0x3100000000000000ULL))
+ FAILURE
+ if (! compare64 (0.E-7DD, 0x30e0000000000000ULL))
+ FAILURE
+ if (! compare64 (0.E+2DD, 0x3200000000000000ULL))
+ FAILURE
+
+ if (! compare128 (0.DL, 0x3040000000000000ULL, 0x0000000000000000ULL))
+ FAILURE
+ if (! compare128 (-0.DL, 0xb040000000000000ULL, 0x0000000000000000ULL))
+ FAILURE
+ if (! compare128 (0.E-3DL, 0x303a000000000000ULL, 0x0000000000000000ULL))
+ FAILURE
+ if (! compare128 (0.E-8DL, 0x3030000000000000ULL, 0x0000000000000000ULL))
+ FAILURE
+ if (! compare128 (0.E+2DL, 0x3044000000000000ULL, 0x0000000000000000ULL))
+ FAILURE
+}
+
+int
+main ()
+{
+ u32_t u32;
+
+ /* These sizes are probably always true for targets that support decimal
+ float types, but check anyway. Abort so we can fix the test. */
+ if ((sizeof (_Decimal64) != sizeof (long long))
+ || (sizeof (_Decimal128) != 2 * sizeof (long long))
+ || (sizeof (_Decimal32) != sizeof (_Decimal32)))
+ FAILURE
+
+ u32.d = 1.DF;
+
+ if (u32.i == 0x22500001)
+ {
+ big_endian = (u32.b[0] == 0x22);
+ dpd_tests ();
+ }
+ else if (u32.i == 0x32800001)
+ {
+ big_endian = (u32.b[0] == 0x32);
+ bid_tests ();
+ }
+ else
+ FAILURE /* unknown format; test problem */
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/convert-bfp-10.c b/gcc/testsuite/c-c++-common/dfp/convert-bfp-10.c
new file mode 100644
index 000000000..3fef98a33
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/convert-bfp-10.c
@@ -0,0 +1,107 @@
+/* This test assumes IEEE float and double. */
+
+#include "convert.h"
+
+volatile _Decimal32 sd;
+volatile _Decimal64 dd;
+volatile _Decimal128 td;
+volatile float sf;
+volatile double df;
+
+/* Conversions using denormalized float values. */
+CONVERT_VALID (111, sf, sd, 1.2e-38f, 1.2e-38df, 0.df)
+CONVERT_VALID (112, sf, sd, 1.1e-38f, 1.1e-38df, 0.df)
+CONVERT_VALID (113, sf, sd, 1.1e-40f, 1.1e-40df, 1.1e-45df)
+
+CONVERT_VALID (121, sd, sf, 1.2e-38df, 1.2e-38f, 0.f)
+CONVERT_VALID (122, sd, sf, 1.1e-38df, 1.1e-38f, 0.f)
+
+CONVERT_VALID (131, sf, sd, -1.2e-38f, -1.2e-38df, 0.df)
+CONVERT_VALID (132, sf, sd, -1.1e-38f, -1.1e-38df, 0.df)
+
+CONVERT_VALID (141, sd, sf, -1.2e-38df, -1.2e-38f, 0.f)
+CONVERT_VALID (142, sd, sf, -1.1e-38df, -1.1e-38f, 0.f)
+
+/* Conversions using denormalized double values. */
+CONVERT_VALID (211, df, sd, 1.2e-38, 1.2e-38df, 0.df)
+CONVERT_VALID (212, df, sd, 1.1e-38, 1.1e-38df, 0.df)
+CONVERT_VALID (213, df, sd, 1.e-40, 1.e-40df, 0.df)
+CONVERT_VALID (214, df, sd, 8.e-44, 8.e-44df, 0.df)
+CONVERT_VALID (215, df, sd, 9.e-44, 9.e-44df, 0.df)
+CONVERT_VALID (216, df, sd, 8.e-46, 8.e-46df, 0.df)
+CONVERT_VALID (217, df, sd, 7.e-46, 7.e-46df, 0.df)
+
+CONVERT_VALID (221, sd, df, 1.2e-38df, 1.2e-38, 1.e-53)
+CONVERT_VALID (222, sd, df, 1.1e-38df, 1.1e-38, 1.e-53)
+CONVERT_VALID (223, sd, df, 1.e-40df, 1.e-40, 0.)
+CONVERT_VALID (224, sd, df, 8.e-44df, 8.e-44, 0.)
+CONVERT_VALID (225, sd, df, 9.e-44df, 9.e-44, 0.)
+CONVERT_VALID (226, sd, df, 8.e-46df, 8.e-46, 0.)
+CONVERT_VALID (227, sd, df, 7.e-46df, 7.e-46, 0.)
+
+CONVERT_VALID (231, df, sd, -1.2e-38, -1.2e-38df, 0.df)
+CONVERT_VALID (232, df, sd, -1.1e-38f, -1.1e-38df, 0.df)
+CONVERT_VALID (233, df, sd, -1.e-40, -1.e-40df, 0.df)
+CONVERT_VALID (234, df, sd, -8.e-44, -8.e-44df, 0.df)
+CONVERT_VALID (235, df, sd, -9.e-44, -9.e-44df, 0.df)
+CONVERT_VALID (236, df, sd, -8.e-46, -8.e-46df, 0.df)
+CONVERT_VALID (237, df, sd, -7.e-46, -7.e-46df, 0.df)
+
+CONVERT_VALID (241, sd, df, -1.2e-38df, -1.2e-38, 1.e-53)
+CONVERT_VALID (242, sd, df, -1.1e-38df, -1.1e-38, 1.e-53)
+CONVERT_VALID (243, sd, df, -1.e-40df, -1.e-40, 0.)
+CONVERT_VALID (244, sd, df, -8.e-44df, -8.e-44, 0.)
+CONVERT_VALID (245, sd, df, -9.e-44df, -9.e-44, 0.)
+CONVERT_VALID (246, sd, df, -8.e-46df, -8.e-46, 0.)
+CONVERT_VALID (247, sd, df, -7.e-46df, -7.e-46, 0.)
+
+int
+main ()
+{
+ convert_111 ();
+ convert_112 ();
+ convert_113 ();
+
+ convert_121 ();
+ convert_122 ();
+
+ convert_131 ();
+ convert_132 ();
+
+ convert_141 ();
+ convert_142 ();
+
+ convert_211 ();
+ convert_212 ();
+ convert_213 ();
+ convert_214 ();
+ convert_215 ();
+ convert_216 ();
+ convert_217 ();
+
+ convert_221 ();
+ convert_222 ();
+ convert_223 ();
+ convert_224 ();
+ convert_225 ();
+ convert_226 ();
+ convert_227 ();
+
+ convert_231 ();
+ convert_232 ();
+ convert_233 ();
+ convert_234 ();
+ convert_235 ();
+ convert_236 ();
+ convert_237 ();
+
+ convert_241 ();
+ convert_242 ();
+ convert_243 ();
+ convert_244 ();
+ convert_245 ();
+ convert_246 ();
+ convert_247 ();
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/convert-bfp-11.c b/gcc/testsuite/c-c++-common/dfp/convert-bfp-11.c
new file mode 100644
index 000000000..d16919f81
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/convert-bfp-11.c
@@ -0,0 +1,58 @@
+/* { dg-skip-if "" { ! "powerpc*-*-linux*" } { "*" } { "" } } */
+
+/* Test decimal float conversions to and from IBM 128-bit long double.
+ Checks are skipped at runtime if long double is not 128 bits.
+ Don't force 128-bit long doubles because runtime support depends
+ on glibc. */
+
+#include "convert.h"
+
+volatile _Decimal32 sd;
+volatile _Decimal64 dd;
+volatile _Decimal128 td;
+volatile float sf;
+volatile double df;
+volatile long double tf;
+
+/* A value slightly less than DEC32_MAX can be converted in both directions. */
+CONVERT_VALID (101, sd, tf, 9.999998e96df, 9.999998e96L, 1.e+81L)
+CONVERT_VALID (102, tf, sd, 9.999998e96L, 9.999998e96df, 0.df)
+
+/* A value slightly less than DBL_MAX can be converted in both directions. */
+CONVERT_VALID (201, tf, dd, 1.79768e+308l, 1.79768e+308dd, 0.dd)
+CONVERT_VALID (202, dd, tf, 1.79768e+308dd, 1.79768e+308l, 2.e292l)
+CONVERT_VALID (203, tf, td, 1.79768e+308l, 1.79768e+308dl, 1.e292dl)
+CONVERT_VALID (204, td, tf, 1.79768e+308dl, 1.79768e+308l, 2.e292l)
+
+/* Check values that are too large for the result type. */
+CONVERT_TO_PINF (301, dd, tf, 1.8e+308dd, l)
+CONVERT_TO_PINF (302, dd, tf, 9.9e+384dd, l)
+CONVERT_TO_PINF (303, td, tf, 1.8e+308dl, l)
+CONVERT_TO_PINF (304, td, tf, 9.9e+384dl, l)
+
+CONVERT_TO_PINF (311, tf, sd, 1.0e+97L, d32)
+CONVERT_TO_PINF (312, tf, sd, 1.6e+308L, d32)
+
+int
+main ()
+{
+ if (sizeof (long double) != 16)
+ return 0;
+
+ convert_101 ();
+ convert_102 ();
+
+ convert_201 ();
+ convert_202 ();
+ convert_203 ();
+ convert_204 ();
+
+ convert_301 ();
+ convert_302 ();
+ convert_303 ();
+ convert_304 ();
+ convert_311 ();
+ convert_312 ();
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/convert-bfp-12.c b/gcc/testsuite/c-c++-common/dfp/convert-bfp-12.c
new file mode 100644
index 000000000..7a909552a
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/convert-bfp-12.c
@@ -0,0 +1,16 @@
+/* Test for bug where fold wrongly removed conversions to double and
+ replaced them by conversions to float. */
+
+#include "dfp-dbg.h"
+
+volatile float f = __builtin_inff ();
+volatile _Decimal32 d32 = 1e40DF;
+
+int
+main (void)
+{
+ if ((double) f == (double) d32)
+ FAILURE
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/convert-bfp-13.c b/gcc/testsuite/c-c++-common/dfp/convert-bfp-13.c
new file mode 100644
index 000000000..259cc745c
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/convert-bfp-13.c
@@ -0,0 +1,18 @@
+/* Test for bug where fold changed binary operation to decimal
+ depending on typedefs. */
+
+#include "dfp-dbg.h"
+
+volatile double d = 1.2345675;
+
+typedef const volatile _Decimal32 d32;
+
+int
+main (void)
+{
+ _Decimal32 a = (d * d);
+ d32 b = (d * d);
+ if (a != b)
+ FAILURE
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/convert-bfp-14.c b/gcc/testsuite/c-c++-common/dfp/convert-bfp-14.c
new file mode 100644
index 000000000..858c92980
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/convert-bfp-14.c
@@ -0,0 +1,15 @@
+/* Test for bug where fold narrowed decimal floating-point
+ operations. */
+
+#include "dfp-dbg.h"
+
+volatile _Decimal32 f = 1.23456DF;
+volatile _Decimal64 d = 1.23456DD;
+
+int
+main (void)
+{
+ if ((double)((_Decimal64)f * (_Decimal64)f) != (double)(d * d))
+ FAILURE
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/convert-bfp-2.c b/gcc/testsuite/c-c++-common/dfp/convert-bfp-2.c
new file mode 100644
index 000000000..463d27f35
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/convert-bfp-2.c
@@ -0,0 +1,33 @@
+/* This test assumes IEEE float and double. It also tests long double
+ but makes no assumption about its size or range of values. */
+
+#include "convert.h"
+
+volatile _Decimal32 sd;
+volatile _Decimal64 dd;
+volatile _Decimal128 td;
+volatile float sf;
+volatile double df;
+volatile long double tf; /* might actually be df or xf, doesn't matter */
+
+CONVERT_VALID_ALL (t1, 0.0, 0.)
+CONVERT_VALID_ALL (t2, 1.0, 0.)
+CONVERT_VALID_ALL (t3, -11.5, 0.)
+CONVERT_VALID_ALL (t4, 7.0, 0.1e-14)
+CONVERT_VALID_ALL (t5, -7.0, 0.1e-14)
+CONVERT_VALID_ALL (t6, 999999., 0.)
+CONVERT_VALID_ALL (t7, -999999., 0.)
+
+int
+main ()
+{
+ CALL_VALID_ALL (t1)
+ CALL_VALID_ALL (t2)
+ CALL_VALID_ALL (t3)
+ CALL_VALID_ALL (t4)
+ CALL_VALID_ALL (t5)
+ CALL_VALID_ALL (t6)
+ CALL_VALID_ALL (t7)
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/convert-bfp-3.c b/gcc/testsuite/c-c++-common/dfp/convert-bfp-3.c
new file mode 100644
index 000000000..3e1d9d57a
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/convert-bfp-3.c
@@ -0,0 +1,21 @@
+/* This test assumes IEEE float and double. It also tests long double
+ but makes no assumption about its size or range of values. */
+
+#include "convert.h"
+
+volatile _Decimal32 sd;
+volatile _Decimal64 dd;
+volatile _Decimal128 td;
+volatile float sf;
+volatile double df;
+volatile long double tf; /* might actually be df or xf, doesn't matter */
+
+CONVERT_ZEROES_ALL (t);
+
+int
+main ()
+{
+ CALL_ZEROES_ALL (t)
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/convert-bfp-4.c b/gcc/testsuite/c-c++-common/dfp/convert-bfp-4.c
new file mode 100644
index 000000000..b97b9c6cb
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/convert-bfp-4.c
@@ -0,0 +1,21 @@
+/* This test assumes IEEE float and double. It also tests long double
+ but makes no assumption about its size or range of values. */
+
+#include "convert.h"
+
+volatile _Decimal32 sd;
+volatile _Decimal64 dd;
+volatile _Decimal128 td;
+volatile float sf;
+volatile double df;
+volatile long double tf; /* might actually be df or xf, doesn't matter */
+
+CONVERT_INF_ALL (t);
+
+int
+main ()
+{
+ CALL_INF_ALL (t)
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/convert-bfp-5.c b/gcc/testsuite/c-c++-common/dfp/convert-bfp-5.c
new file mode 100644
index 000000000..ada2d352c
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/convert-bfp-5.c
@@ -0,0 +1,21 @@
+/* This test assumes IEEE float and double. It also tests long double
+ but makes no assumption about its size or range of values. */
+
+#include "convert.h"
+
+volatile _Decimal32 sd;
+volatile _Decimal64 dd;
+volatile _Decimal128 td;
+volatile float sf;
+volatile double df;
+volatile long double tf; /* might actually be df or xf, doesn't matter */
+
+CONVERT_NAN_ALL (t);
+
+int
+main ()
+{
+ CALL_NAN_ALL (t)
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/convert-bfp-6.c b/gcc/testsuite/c-c++-common/dfp/convert-bfp-6.c
new file mode 100644
index 000000000..64198a95f
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/convert-bfp-6.c
@@ -0,0 +1,178 @@
+/* { dg-xfail-run-if "" { lax_strtofp } "*" "" } */
+/* { dg-options "-w" } */
+
+/* This test assumes IEEE float and double. */
+
+#define __STDC_WANT_DEC_FP__
+#include <float.h>
+
+#include "convert.h"
+
+volatile _Decimal32 sd;
+volatile _Decimal64 dd;
+volatile _Decimal128 td;
+volatile float sf;
+volatile double df;
+volatile long double tf;
+
+CONVERT_VALID (101, td, sf, 0.000488281251dl, 0.00048828125f, 0.f)
+
+/* 2**(-25) = 0.298023223876953125E-7. */
+CONVERT_VALID (102, td, sf, 2.98023223876953125e-8dl, 2.9802322387695312e-08f,
+ 01.e-13f)
+
+/* Fractional part doesn't fit. */
+CONVERT_VALID (103, df, sd, 1.0e-20, 1.0e-20df, 0.df)
+
+/* Exact power of 2. */
+CONVERT_VALID (104, df, sd, 0.00048828125, 0.00048828125df, 0.df)
+CONVERT_VALID (105, df, sd, 1.0e-96, 0.dd, DEC32_MIN)
+
+/* A value slightly less than FLT_MAX can be converted in both directions. */
+CONVERT_VALID (201, sf, sd, 3.402819e+38f, 3.402819e+38df, 0.df)
+CONVERT_VALID (202, sd, sf, 3.402819e+38df, 3.402819e+38f, 0.f)
+CONVERT_VALID (203, sf, dd, 3.402819e+38f, 3.402819e+38dd, 1.e+30dd)
+CONVERT_VALID (204, dd, sf, 3.402819e+38dd, 3.402819e+38f, 0.f)
+CONVERT_VALID (205, sf, td, 3.402819e+38f, 3.402819e+38dl, 1.e+30dl)
+CONVERT_VALID (206, td, sf, 3.402819e+38dl, 3.402819e+38f, 0.f)
+
+/* A value slightly less than DEC32_MAX can be converted in both directions. */
+CONVERT_VALID (211, sd, df, 9.999998e96df, 9.999998e96, 0.)
+CONVERT_VALID (212, df, sd, 9.999998e96, 9.999998e96df, 0.df)
+
+/* A value slightly less than DBL_MAX can be converted in both directions. */
+CONVERT_VALID (221, df, dd, 1.79768e+308, 1.79768e+308dd, 0.dd)
+CONVERT_VALID (222, dd, df, 1.79768e+308dd, 1.79768e+308, 0.)
+CONVERT_VALID (223, df, td, 1.79768e+308, 1.79768e+308dl, 1.e292dl)
+CONVERT_VALID (224, td, df, 1.79768e+308dl, 1.79768e+308, 0.)
+
+/* An integral value with 6 digits (FLT_DIG) can be converted between float
+ and _Decimal32 in both directions. */
+CONVERT_VALID (301, sd, sf, 100000.DF, 100000.F, 0.F)
+CONVERT_VALID (302, sf, sd, 100000.F, 100000.DF, 0.DF)
+CONVERT_VALID (303, sd, sf, 999999.DF, 999999.F, 0.F)
+CONVERT_VALID (304, sf, sd, 999999.F, 999999.DF, 0.DF)
+
+/* An integral value with 7 digits (DEC32_MANT_DIG) can be converted between
+ _Decimal32 and double in both directions. */
+CONVERT_VALID (311, sd, df, 1000000.DF, 1000000., 0.)
+CONVERT_VALID (312, df, sd, 1000000., 1000000.DF, 0.DF)
+CONVERT_VALID (313, sd, df, 9999999.DF, 9999999., 0.)
+CONVERT_VALID (314, df, sd, 9999999., 9999999.DF, 0.DF)
+
+/* An integral value with 15 digits (DBL_DIG) can be converted between
+ double and _Decimal64 in both directions. */
+CONVERT_VALID (321, dd, df, 100000000000000.DD, 100000000000000., 0.)
+CONVERT_VALID (322, df, dd, 100000000000000., 100000000000000.DD, 0.DD);
+CONVERT_VALID (323, dd, df, 999999999999999.DD, 999999999999999., 0.);
+CONVERT_VALID (324, df, dd, 999999999999999., 999999999999999.DD, 0.DD);
+
+/* If LDBL_DIG is at least 16, an integral value with 16 digits can be
+ converted between _Decimal64 and long double in both directions. */
+CONVERT_VALID (331, dd, tf, 1000000000000000.DD, 1000000000000000.L, 0.L)
+CONVERT_VALID (332, td, dd, 1000000000000000.L, 1000000000000000.DD, 0.DD)
+CONVERT_VALID (333, dd, tf, 9999999999999999.DD, 9999999999999999.L, 0.L)
+CONVERT_VALID (334, td, dd, 9999999999999999.L, 9999999999999999.DD, 0.DD)
+
+/* If LDBL_DIG is at least 18, an integral value with 18 digits can be
+ converted between long double and _Decimal128 in both directions. */
+CONVERT_VALID (341, td, tf, 100000000000000000.DL, 100000000000000000.L, 0.L)
+CONVERT_VALID (342, tf, td, 100000000000000000.L, 100000000000000000.DL, 0.DL)
+CONVERT_VALID (343, td, tf, 999999999999999999.DL, 999999999999999999.L, 0.L)
+CONVERT_VALID (344, tf, td, 999999999999999999.L, 999999999999999999.DL, 0.DL)
+
+/* If LDBL_DIG is at least 31, an integral value with 31 digits can be
+ converted between long double and _Decimal128 in both directions. */
+CONVERT_VALID (351, td, tf, 1000000000000000000000000000000.DL,
+ 1000000000000000000000000000000.L, 0.L)
+CONVERT_VALID (352, tf, td, 1000000000000000000000000000000.L,
+ 1000000000000000000000000000000.DL, 0.DL)
+CONVERT_VALID (353, td, tf, 9999999999999999999999999999999.DL,
+ 9999999999999999999999999999999.L, 0.L)
+CONVERT_VALID (354, tf, td, 9999999999999999999999999999999.L,
+ 9999999999999999999999999999999.DL, 0.DL)
+
+/* If LDBL_DIG is at least 33, an integral value with 33 digits can be
+ converted between long double and _Decimal128 in both directions. */
+CONVERT_VALID (361, td, tf, 100000000000000000000000000000000.DL,
+ 100000000000000000000000000000000.L, 0.L)
+CONVERT_VALID (362, tf, td, 100000000000000000000000000000000.L,
+ 100000000000000000000000000000000.DL, 0.DL)
+CONVERT_VALID (363, td, tf, 999999999999999999999999999999999.DL,
+ 999999999999999999999999999999999.L, 0.L)
+CONVERT_VALID (364, tf, td, 999999999999999999999999999999999.L,
+ 999999999999999999999999999999999.DL, 0.DL)
+
+int
+main ()
+{
+ convert_101 ();
+ convert_102 ();
+ convert_103 ();
+ convert_104 ();
+ convert_105 ();
+
+ convert_201 ();
+ convert_202 ();
+ convert_203 ();
+ convert_204 ();
+ convert_205 ();
+ convert_206 ();
+
+ convert_211 ();
+ convert_212 ();
+
+ convert_221 ();
+ convert_222 ();
+ convert_223 ();
+ convert_224 ();
+
+ convert_301 ();
+ convert_302 ();
+ convert_303 ();
+ convert_304 ();
+
+ convert_311 ();
+ convert_312 ();
+ convert_313 ();
+ convert_314 ();
+
+ convert_321 ();
+ convert_322 ();
+ convert_323 ();
+ convert_324 ();
+
+ if (LDBL_DIG >= 16)
+ {
+ convert_331 ();
+ convert_332 ();
+ convert_333 ();
+ convert_334 ();
+ }
+
+ if (LDBL_DIG >= 18)
+ {
+ convert_341 ();
+ convert_342 ();
+ convert_343 ();
+ convert_344 ();
+ }
+
+ if (LDBL_DIG >= 31)
+ {
+ convert_351 ();
+ convert_352 ();
+ convert_353 ();
+ convert_354 ();
+ }
+
+ if (LDBL_DIG >= 33)
+ {
+ convert_361 ();
+ convert_362 ();
+ convert_363 ();
+ convert_364 ();
+ }
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/convert-bfp-7.c b/gcc/testsuite/c-c++-common/dfp/convert-bfp-7.c
new file mode 100644
index 000000000..f51d696ce
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/convert-bfp-7.c
@@ -0,0 +1,83 @@
+/* { dg-options "-w" } */
+
+/* This test assumes IEEE float and double. */
+
+#define __STDC_WANT_DEC_FP__
+#include <float.h>
+
+#include "convert.h"
+
+volatile _Decimal32 sd;
+volatile _Decimal64 dd;
+volatile _Decimal128 td;
+volatile float sf;
+volatile double df;
+
+/* Check values that are too large for the result type. */
+CONVERT_TO_PINF (301, sd, sf, 4.e+38df, f)
+CONVERT_TO_PINF (303, dd, sf, 4.e+38dd, f)
+CONVERT_TO_PINF (302, sd, sf, 9.9e+384df, f)
+CONVERT_TO_PINF (304, dd, sf, 9.9e+384dd, f)
+CONVERT_TO_PINF (305, td, sf, 4.e+38dl, f)
+CONVERT_TO_PINF (306, td, sf, 1.e+39dl, f)
+CONVERT_TO_MINF (311, sd, sf, -4.e+38df, f)
+CONVERT_TO_MINF (312, dd, sf, -4.e+38dd, f)
+CONVERT_TO_MINF (313, sd, sf, -9.9e+384df, f)
+CONVERT_TO_MINF (314, dd, sf, -9.9e+384dd, f)
+CONVERT_TO_MINF (315, td, sf, -4.e+38dl, f)
+CONVERT_TO_MINF (316, td, sf, -1.e+39dl, f)
+
+CONVERT_TO_PINF (321, dd, df, 1.8e+308dd,)
+CONVERT_TO_PINF (322, dd, df, 9.9e+384dd,)
+CONVERT_TO_PINF (323, td, df, 1.8e+308dl,)
+CONVERT_TO_PINF (324, td, df, 9.9e+384dl,)
+CONVERT_TO_PINF (325, dd, df, 1.e309dd,)
+CONVERT_TO_PINF (326, td, df, 1.e309dl,)
+CONVERT_TO_MINF (331, dd, df, -1.8e+308dd,)
+CONVERT_TO_MINF (332, dd, df, -9.9e+384dd,)
+CONVERT_TO_MINF (333, td, df, -1.8e+308dl,)
+CONVERT_TO_MINF (334, td, df, -9.9e+384dl,)
+CONVERT_TO_MINF (335, dd, df, -1.e309dd,)
+CONVERT_TO_MINF (336, td, df, -1.e309dl,)
+
+CONVERT_TO_PINF (341, df, sd, 1.0e+97, d32)
+CONVERT_TO_PINF (342, df, sd, 1.6e+308, d32)
+CONVERT_TO_MINF (351, df, sd, -1.0e+97, d32)
+CONVERT_TO_MINF (352, df, sd, -1.6e+308, d32)
+
+int
+main ()
+{
+ convert_301 ();
+ convert_302 ();
+ convert_303 ();
+ convert_304 ();
+ convert_305 ();
+ convert_306 ();
+ convert_311 ();
+ convert_312 ();
+ convert_313 ();
+ convert_314 ();
+ convert_315 ();
+ convert_316 ();
+
+ convert_321 ();
+ convert_322 ();
+ convert_323 ();
+ convert_324 ();
+ convert_325 ();
+ convert_326 ();
+ convert_331 ();
+ convert_332 ();
+ convert_333 ();
+ convert_334 ();
+ convert_335 ();
+ convert_336 ();
+
+ convert_341 ();
+ convert_342 ();
+ convert_351 ();
+ convert_352 ();
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/convert-bfp-8.c b/gcc/testsuite/c-c++-common/dfp/convert-bfp-8.c
new file mode 100644
index 000000000..532bd8613
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/convert-bfp-8.c
@@ -0,0 +1,71 @@
+/* { dg-options "-w" } */
+
+/* This test assumes IEEE float and double. */
+
+#define __STDC_WANT_DEC_FP__
+#include <float.h>
+
+#include "convert.h"
+
+volatile _Decimal32 sd;
+volatile _Decimal64 dd;
+volatile _Decimal128 td;
+volatile float sf;
+volatile double df;
+
+/* Values slightly smaller than minimum (closest to zero) for result type. */
+CONVERT_VALID (401, sd, sf, 1.e-39df, 0.f, FLT_MIN)
+CONVERT_VALID (402, sd, sf, -1.e-39df, 0.f, FLT_MIN)
+CONVERT_VALID (403, sd, sf, 1.1e-38df, 0.f, FLT_MIN)
+CONVERT_VALID (404, sd, sf, -1.1e-38df, 0.f, FLT_MIN)
+
+CONVERT_VALID (411, dd, sf, 1.e-39dd, 0.f, FLT_MIN)
+CONVERT_VALID (412, dd, sf, -1.e-39dd, 0.f, FLT_MIN)
+CONVERT_VALID (413, dd, sf, 1.1e-38dd, 0.f, FLT_MIN)
+CONVERT_VALID (414, dd, sf, -1.1e-38dd, 0.f, FLT_MIN)
+
+CONVERT_VALID (421, dd, df, 3.e-309dd, 0., DBL_MIN)
+CONVERT_VALID (422, dd, df, -3.e-309dd, 0., DBL_MIN)
+CONVERT_VALID (423, dd, df, 2.e-308dd, 0., DBL_MIN)
+CONVERT_VALID (424, dd, df, -2.e-308dd, 0., DBL_MIN)
+
+CONVERT_VALID (431, td, sf, 1.e-39dl, 0.f, FLT_MIN)
+CONVERT_VALID (432, td, sf, -1.e-39dl, 0.f, FLT_MIN)
+CONVERT_VALID (433, td, sf, 1.1e-38dl, 0.f, FLT_MIN)
+CONVERT_VALID (434, td, sf, -1.1e-38dl, 0.f, FLT_MIN)
+
+CONVERT_VALID (441, td, df, 3.e-309dl, 0., DBL_MIN)
+CONVERT_VALID (442, td, df, -3.e-309dl, 0., DBL_MIN)
+CONVERT_VALID (443, td, df, 2.e-308dl, 0., DBL_MIN)
+CONVERT_VALID (444, td, df, -2.e-308dl, 0., DBL_MIN)
+
+int
+main ()
+{
+ convert_401 ();
+ convert_402 ();
+ convert_403 ();
+ convert_404 ();
+
+ convert_411 ();
+ convert_412 ();
+ convert_413 ();
+ convert_414 ();
+
+ convert_421 ();
+ convert_422 ();
+ convert_423 ();
+ convert_424 ();
+
+ convert_431 ();
+ convert_432 ();
+ convert_433 ();
+ convert_434 ();
+
+ convert_441 ();
+ convert_442 ();
+ convert_443 ();
+ convert_444 ();
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/convert-bfp-9.c b/gcc/testsuite/c-c++-common/dfp/convert-bfp-9.c
new file mode 100644
index 000000000..e60908752
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/convert-bfp-9.c
@@ -0,0 +1,192 @@
+/* { dg-xfail-run-if "" { lax_strtofp } "*" "" } */
+/* { dg-options "-w" } */
+
+/* This test assumes IEEE float and double. */
+
+#define __STDC_WANT_DEC_FP__
+#include <float.h>
+
+#include "convert.h"
+
+volatile _Decimal32 sd;
+volatile _Decimal64 dd;
+volatile _Decimal128 td;
+volatile float sf;
+volatile double df;
+
+/* Exponent values that might cause problems with a particular
+ implementation. */
+
+CONVERT_VALID (101, dd, df, 1.e309dd, 1.e309, 0.)
+CONVERT_VALID (102, dd, df, 1.e308dd, 1.e308, 0.)
+CONVERT_VALID (103, dd, df, 1.e307dd, 1.e307, 0.)
+CONVERT_VALID (104, dd, df, 1.e306dd, 1.e306, 0.)
+CONVERT_VALID (105, dd, df, 1.e305dd, 1.e305, 0.)
+CONVERT_VALID (106, dd, df, 1.e304dd, 1.e304, 0.)
+CONVERT_VALID (107, dd, df, 1.e303dd, 1.e303, 0.)
+CONVERT_VALID (108, dd, df, 1.e302dd, 1.e302, 0.)
+CONVERT_VALID (109, dd, df, 1.e301dd, 1.e301, 0.)
+CONVERT_VALID (110, dd, df, 1.e300dd, 1.e300, 0.)
+CONVERT_VALID (111, dd, df, 1.e299dd, 1.e299, 0.)
+CONVERT_VALID (112, dd, df, 1.e298dd, 1.e298, 0.)
+CONVERT_VALID (113, dd, df, 1.e297dd, 1.e297, 0.)
+CONVERT_VALID (114, dd, df, 1.e296dd, 1.e296, 0.)
+CONVERT_VALID (115, dd, df, 1.e295dd, 1.e295, 0.)
+CONVERT_VALID (116, dd, df, 1.e294dd, 1.e294, 0.)
+CONVERT_VALID (117, dd, df, 1.e293dd, 1.e293, 0.)
+CONVERT_VALID (118, dd, df, 1.e292dd, 1.e292, 0.)
+CONVERT_VALID (119, dd, df, 1.e291dd, 1.e291, 0.)
+CONVERT_VALID (120, dd, df, 1.e290dd, 1.e290, 0.)
+
+CONVERT_VALID (201, dd, df, 1.e-309dd, 1.e-309, 0.)
+CONVERT_VALID (202, dd, df, 1.e-308dd, 1.e-308, 0.)
+CONVERT_VALID (203, dd, df, 1.e-307dd, 1.e-307, 0.)
+CONVERT_VALID (204, dd, df, 1.e-306dd, 1.e-306, 0.)
+CONVERT_VALID (205, dd, df, 1.e-305dd, 1.e-305, 0.)
+CONVERT_VALID (206, dd, df, 1.e-304dd, 1.e-304, 0.)
+CONVERT_VALID (207, dd, df, 1.e-303dd, 1.e-303, 0.)
+CONVERT_VALID (208, dd, df, 1.e-302dd, 1.e-302, 0.)
+CONVERT_VALID (209, dd, df, 1.e-301dd, 1.e-301, 0.)
+CONVERT_VALID (210, dd, df, 1.e-300dd, 1.e-300, 0.)
+CONVERT_VALID (211, dd, df, 1.e-299dd, 1.e-299, 0.)
+CONVERT_VALID (212, dd, df, 1.e-298dd, 1.e-298, 0.)
+CONVERT_VALID (213, dd, df, 1.e-297dd, 1.e-297, 0.)
+CONVERT_VALID (214, dd, df, 1.e-296dd, 1.e-296, 0.)
+CONVERT_VALID (215, dd, df, 1.e-295dd, 1.e-295, 0.)
+CONVERT_VALID (216, dd, df, 1.e-294dd, 1.e-294, 0.)
+CONVERT_VALID (217, dd, df, 1.e-293dd, 1.e-293, 0.)
+CONVERT_VALID (218, dd, df, 1.e-292dd, 1.e-292, 0.)
+CONVERT_VALID (219, dd, df, 1.e-291dd, 1.e-291, 0.)
+CONVERT_VALID (220, dd, df, 1.e-290dd, 1.e-290, 0.)
+
+CONVERT_VALID (301, td, df, 1.e309dl, 1.e309, 0.)
+CONVERT_VALID (302, td, df, 1.e308dl, 1.e308, 0.)
+CONVERT_VALID (303, td, df, 1.e307dl, 1.e307, 0.)
+CONVERT_VALID (304, td, df, 1.e306dl, 1.e306, 0.)
+CONVERT_VALID (305, td, df, 1.e305dl, 1.e305, 0.)
+CONVERT_VALID (306, td, df, 1.e304dl, 1.e304, 0.)
+CONVERT_VALID (307, td, df, 1.e303dl, 1.e303, 0.)
+CONVERT_VALID (308, td, df, 1.e302dl, 1.e302, 0.)
+CONVERT_VALID (309, td, df, 1.e301dl, 1.e301, 0.)
+CONVERT_VALID (310, td, df, 1.e300dl, 1.e300, 0.)
+CONVERT_VALID (311, td, df, 1.e299dl, 1.e299, 0.)
+CONVERT_VALID (312, td, df, 1.e298dl, 1.e298, 0.)
+CONVERT_VALID (313, td, df, 1.e297dl, 1.e297, 0.)
+CONVERT_VALID (314, td, df, 1.e296dl, 1.e296, 0.)
+CONVERT_VALID (315, td, df, 1.e295dl, 1.e295, 0.)
+CONVERT_VALID (316, td, df, 1.e294dl, 1.e294, 0.)
+CONVERT_VALID (317, td, df, 1.e293dl, 1.e293, 0.)
+CONVERT_VALID (318, td, df, 1.e292dl, 1.e292, 0.)
+CONVERT_VALID (319, td, df, 1.e291dl, 1.e291, 0.)
+CONVERT_VALID (320, td, df, 1.e290dl, 1.e290, 0.)
+
+CONVERT_VALID (401, td, df, 1.e-309dl, 1.e-309, 0.)
+CONVERT_VALID (402, td, df, 1.e-308dl, 1.e-308, 0.)
+CONVERT_VALID (403, td, df, 1.e-307dl, 1.e-307, 0.)
+CONVERT_VALID (404, td, df, 1.e-306dl, 1.e-306, 0.)
+CONVERT_VALID (405, td, df, 1.e-305dl, 1.e-305, 0.)
+CONVERT_VALID (406, td, df, 1.e-304dl, 1.e-304, 0.)
+CONVERT_VALID (407, td, df, 1.e-303dl, 1.e-303, 0.)
+CONVERT_VALID (408, td, df, 1.e-302dl, 1.e-302, 0.)
+CONVERT_VALID (409, td, df, 1.e-301dl, 1.e-301, 0.)
+CONVERT_VALID (410, td, df, 1.e-300dl, 1.e-300, 0.)
+CONVERT_VALID (411, td, df, 1.e-299dl, 1.e-299, 0.)
+CONVERT_VALID (412, td, df, 1.e-298dl, 1.e-298, 0.)
+CONVERT_VALID (413, td, df, 1.e-297dl, 1.e-297, 0.)
+CONVERT_VALID (414, td, df, 1.e-296dl, 1.e-296, 0.)
+CONVERT_VALID (415, td, df, 1.e-295dl, 1.e-295, 0.)
+CONVERT_VALID (416, td, df, 1.e-294dl, 1.e-294, 0.)
+CONVERT_VALID (417, td, df, 1.e-293dl, 1.e-293, 0.)
+CONVERT_VALID (418, td, df, 1.e-292dl, 1.e-292, 0.)
+CONVERT_VALID (419, td, df, 1.e-291dl, 1.e-291, 0.)
+CONVERT_VALID (420, td, df, 1.e-290dl, 1.e-290, 0.)
+
+int
+main ()
+{
+ convert_101 ();
+ convert_102 ();
+ convert_103 ();
+ convert_104 ();
+ convert_105 ();
+ convert_106 ();
+ convert_107 ();
+ convert_108 ();
+ convert_109 ();
+ convert_110 ();
+ convert_111 ();
+ convert_112 ();
+ convert_113 ();
+ convert_114 ();
+ convert_115 ();
+ convert_116 ();
+ convert_117 ();
+ convert_118 ();
+ convert_119 ();
+ convert_120 ();
+
+ convert_201 ();
+ convert_202 ();
+ convert_203 ();
+ convert_204 ();
+ convert_205 ();
+ convert_206 ();
+ convert_207 ();
+ convert_208 ();
+ convert_209 ();
+ convert_210 ();
+ convert_211 ();
+ convert_212 ();
+ convert_213 ();
+ convert_214 ();
+ convert_215 ();
+ convert_216 ();
+ convert_217 ();
+ convert_218 ();
+ convert_219 ();
+ convert_220 ();
+
+ convert_301 ();
+ convert_302 ();
+ convert_303 ();
+ convert_304 ();
+ convert_305 ();
+ convert_306 ();
+ convert_307 ();
+ convert_308 ();
+ convert_309 ();
+ convert_310 ();
+ convert_311 ();
+ convert_312 ();
+ convert_313 ();
+ convert_314 ();
+ convert_315 ();
+ convert_316 ();
+ convert_317 ();
+ convert_318 ();
+ convert_319 ();
+ convert_320 ();
+
+ convert_401 ();
+ convert_402 ();
+ convert_403 ();
+ convert_404 ();
+ convert_405 ();
+ convert_406 ();
+ convert_407 ();
+ convert_408 ();
+ convert_409 ();
+ convert_410 ();
+ convert_411 ();
+ convert_412 ();
+ convert_413 ();
+ convert_414 ();
+ convert_415 ();
+ convert_416 ();
+ convert_417 ();
+ convert_418 ();
+ convert_419 ();
+ convert_420 ();
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/convert-bfp-fold.c b/gcc/testsuite/c-c++-common/dfp/convert-bfp-fold.c
new file mode 100644
index 000000000..d62a7e4b2
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/convert-bfp-fold.c
@@ -0,0 +1,118 @@
+/* { dg-options "-O2" } */
+
+/* N1150 5.2 Conversions among decimal floating types and between
+ decimal floating types and generic floating types.
+ C99 6.3.1.5(4) Conversions, arithmetic operands, real floating types. */
+
+#include "dfp-dbg.h"
+
+_Decimal32 d32;
+_Decimal64 d64;
+_Decimal128 d128;
+float sf;
+double df;
+long double tf;
+
+extern void link_error (void);
+
+int
+main ()
+{
+ /* Conversions from decimal float to binary float. */
+
+ /* Conversions from _Decimal32. */
+ d32 = 2.0df;
+ sf = d32;
+ if (sf != 2.0f)
+ link_error ();
+
+ df = d32;
+ if (df != 2.0)
+ link_error ();
+
+ tf = d32;
+ if (tf != 2.0l)
+ link_error ();
+
+ /* Conversions from _Decimal64. */
+ d64 = -7.0dd;
+ sf = d64;
+ if (sf != -7.0f)
+ link_error ();
+
+ df = d64;
+ if (df != -7.0)
+ link_error ();
+
+ tf = d64;
+ if (tf != -7.0l)
+ link_error ();
+
+ /* Conversions from _Decimal128. */
+ d128 = 30.0dl;
+ sf = d128;
+ if (sf != 30.0f)
+ link_error ();
+
+ df = d128;
+ if (df != 30.0)
+ link_error ();
+
+ df = d128;
+ if (df != 30.0l)
+ link_error ();
+
+ /* Conversions from binary float to decimal float. */
+ sf = 30.0f;
+ d128 = sf;
+ if (d128 != 30.0dl)
+ link_error ();
+
+ d64 = sf;
+ if (d64 != 30.0dd)
+ link_error ();
+
+ d32 = sf;
+ if (d32 != 30.0df)
+ link_error ();
+
+ df = -2.0;
+ d128 = df;
+ if (d128 != -2.0dl)
+ link_error ();
+
+ d64 = df;
+ if (d64 != -2.0dd)
+ link_error ();
+
+ d32 = df;
+ if (d32 != -2.0df)
+ link_error ();
+
+ tf = -22.0l;
+ d128 = tf;
+ if (d128 != -22.0dl)
+ link_error ();
+
+ d64 = tf;
+ if (d64 != -22.0dd)
+ link_error ();
+
+ d32 = tf;
+ if (d32 != -22.0df)
+ link_error ();
+
+ /* 2**(-11) = 0.00048828125. */
+ d128 = 0.000488281251dl;
+ sf = d128;
+ if (sf != 0.00048828125f)
+ link_error ();
+ /* 2**(-25) = 0.298023223876953125E-7. */
+ d128 = 2.98023223876953125E-8dl;
+ df = d128;
+ if (df < (2.9802322387695312e-08 - 0.00000000001)
+ || df > (2.9802322387695312e-08 + 0.00000000001))
+ link_error ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/convert-bfp.c b/gcc/testsuite/c-c++-common/dfp/convert-bfp.c
new file mode 100644
index 000000000..710538d46
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/convert-bfp.c
@@ -0,0 +1,131 @@
+/* N1150 5.2 Conversions among decimal floating types and between
+ decimal floating types and generic floating types.
+ C99 6.3.1.5(4) Conversions, arithmetic operands, real floating types. */
+
+/* Long double isn't supported yet at runtime, so disable those checks. */
+
+#include "dfp-dbg.h"
+
+static int skip_long_double;
+
+volatile _Decimal32 d32;
+volatile _Decimal64 d64;
+volatile _Decimal128 d128;
+volatile float sf;
+volatile double df;
+volatile long double tf;
+
+int
+main ()
+{
+ /* Conversions from decimal float to binary float. */
+
+ if (sizeof (long double) == sizeof (double))
+ skip_long_double = 1;
+
+ /* Conversions from _Decimal32. */
+ d32 = 2.0df;
+ sf = d32;
+ if (sf != 2.0f)
+ FAILURE
+
+ df = d32;
+ if (df != 2.0)
+ FAILURE
+
+ if (skip_long_double == 0)
+ {
+ tf = d32;
+ if (tf != 2.0l)
+ FAILURE
+ }
+
+ /* Conversions from _Decimal64. */
+ d64 = -7.0dd;
+ sf = d64;
+ if (sf != -7.0f)
+ FAILURE
+
+ df = d64;
+ if (df != -7.0)
+ FAILURE
+
+ if (skip_long_double == 0)
+ {
+ tf = d64;
+ if (tf != -7.0l)
+ FAILURE
+ }
+
+ /* Conversions from _Decimal128. */
+ d128 = 30.0dl;
+ sf = d128;
+ if (sf != 30.0f)
+ FAILURE
+
+ df = d128;
+ if (df != 30.0)
+ FAILURE
+
+ df = d128;
+ if (df != 30.0l)
+ FAILURE
+
+ /* Conversions from binary float to decimal float. */
+ sf = 30.0f;
+ d32 = sf;
+ if (d32 != 30.0df)
+ FAILURE
+
+ d64 = sf;
+ if (d64 != 30.0dd)
+ FAILURE
+
+ df = -2.0;
+ d32 = df;
+ if (d32 != -2.0df)
+ FAILURE
+
+ d64 = df;
+ if (d64 != -2.0dd)
+ FAILURE
+
+ d128 = df;
+ if (d128 != -2.0dl)
+ FAILURE
+
+ sf = 30.0f;
+ d128 = sf;
+ if (d128 != 30.0dl)
+ FAILURE
+
+ if (skip_long_double == 0)
+ {
+ tf = -22.0l;
+ d32 = tf;
+ if (d32 != -22.0df)
+ FAILURE
+
+ d64 = tf;
+ if (d64 != -22.0dd)
+ FAILURE
+
+ d128 = tf;
+ if (d128 != -22.0dl)
+ FAILURE
+ }
+
+ /* 2**(-11) = 0.00048828125. */
+ d128 = 0.000488281251dl;
+ sf = d128;
+ if (sf != 0.00048828125f)
+ FAILURE
+ /* 2**(-25) = 0.298023223876953125E-7. */
+ d128 = 2.98023223876953125E-8dl;
+ df = d128;
+ if (df < (2.9802322387695312e-08 - 0.00000000001)
+ || df > (2.9802322387695312e-08 + 0.00000000001))
+ FAILURE
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/convert-dfp-fold-2.c b/gcc/testsuite/c-c++-common/dfp/convert-dfp-fold-2.c
new file mode 100644
index 000000000..073f7abc4
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/convert-dfp-fold-2.c
@@ -0,0 +1,15 @@
+/* Test for bug where fold narrowed decimal floating-point
+ operations. */
+
+#include "dfp-dbg.h"
+
+volatile _Decimal32 f = 1.23456DF;
+volatile _Decimal64 d = 1.23456DD;
+
+int
+main (void)
+{
+ if ((_Decimal128)((_Decimal64)f * (_Decimal64)f) != (_Decimal128)(d * d))
+ FAILURE
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/convert-dfp-fold.c b/gcc/testsuite/c-c++-common/dfp/convert-dfp-fold.c
new file mode 100644
index 000000000..67c9d71c2
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/convert-dfp-fold.c
@@ -0,0 +1,47 @@
+/* { dg-options "-O2" } */
+
+/* N1150 5.2 Conversions among decimal floating types and between
+ decimal floating types and generic floating types.
+ C99 6.3.1.5(3) New. */
+
+#include "dfp-dbg.h"
+
+extern void link_error ();
+
+int
+main ()
+{
+ _Decimal32 d32;
+ _Decimal64 d64;
+ _Decimal128 d128;
+
+ /* Conversions to larger types. */
+ d32 = 123.4df;
+ d64 = d32;
+ if (d64 != 123.4dd)
+ link_error ();
+ d128 = d32;
+ if (d128 != 123.4dl)
+ link_error ();
+ d64 = 345.678dd;
+ d128 = d64;
+ if (d128 != 345.678dl)
+ link_error ();
+
+ /* Conversions to smaller types for which the value fits. */
+ d64 = 3456.789dd;
+ d32 = d64;
+ if (d32 != 3456.789df)
+ link_error ();
+ d128 = 123.4567dl;
+ d32 = d128;
+ if (d32 != 123.4567dl)
+ link_error ();
+
+ d128 = 1234567890.123456dl;
+ d64 = d128;
+ if (d64 != 1234567890.123456dd)
+ link_error ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/convert-dfp.c b/gcc/testsuite/c-c++-common/dfp/convert-dfp.c
new file mode 100644
index 000000000..d52ba51b0
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/convert-dfp.c
@@ -0,0 +1,94 @@
+/* { dg-options "-O0" } */
+
+/* N1150 5.2 Conversions among decimal floating types and between
+ decimal floating types and generic floating types.
+ C99 6.3.1.5(3) New.
+
+ Test various conversions involving decimal floating types. */
+
+#ifndef __STDC_WANT_DEC_FP__
+#define __STDC_WANT_DEC_FP__ 1
+#endif
+
+#include "dfp-dbg.h"
+#include <float.h>
+
+volatile _Decimal32 d32;
+volatile _Decimal64 d64;
+volatile _Decimal128 d128;
+
+int
+main ()
+{
+ /* Conversions to larger types. */
+ d32 = 123.4df;
+ d64 = d32;
+ if (d64 != 123.4dd)
+ FAILURE
+ d128 = d32;
+ if (d128 != 123.4dl)
+ FAILURE
+ d64 = 345.678dd;
+ d128 = d64;
+ if (d128 != 345.678dl)
+ FAILURE
+
+ /* Conversions to smaller types for which the value fits. */
+ d64 = 3456.789dd;
+ d32 = d64;
+ if (d32 != 3456.789df)
+ FAILURE
+ d128 = 123.4567dl;
+ d32 = d128;
+ if (d32 != 123.4567df)
+ FAILURE
+
+ d128 = 1234567890.123456dl;
+ d64 = d128;
+ if (d64 != 1234567890.123456dd)
+ FAILURE
+
+ /* Test demotion to non-representable decimal floating type. */
+
+ /* Assumes a default rounding mode of 'near'. This uses the rules
+ describe in the 27 July 2005 draft of IEEE 754r, which are much
+ more clear that what's described in draft 5 of N1107. */
+
+ /* Rounds to what _Decimal32 can handle. */
+ d64 = 9.99999949E96DD;
+ d32 = d64;
+ if (d32 != DEC32_MAX)
+ FAILURE
+
+ /* Rounds to more than _Decimal32 can handle. */
+ d64 = 9.9999995E96DD;
+ d32 = d64;
+ if (d32 != __builtin_infd32())
+ FAILURE
+
+ /* Rounds to what _Decimal32 can handle. */
+ d128 = 9.99999949E96DD;
+ d32 = d128;
+ if (d32 != DEC32_MAX)
+ FAILURE
+
+ /* Rounds to more than _Decimal32 can handle. */
+ d128= 9.9999995E96DD;
+ d32 = d128;
+ if (d32 != __builtin_infd32())
+ FAILURE
+
+ /* Rounds to what _Decimal64 can handle. */
+ d128 = 9.99999999999999949E384DL;
+ d64 = d128;
+ if (d64 != DEC64_MAX)
+ FAILURE
+
+ /* Rounds to more than _Decimal64 can handle. */
+ d128 = 9.9999999999999995E384DL;
+ d64 = d128;
+ if (d64 != __builtin_infd64())
+ FAILURE
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/convert-int-fold.c b/gcc/testsuite/c-c++-common/dfp/convert-int-fold.c
new file mode 100644
index 000000000..038559d41
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/convert-int-fold.c
@@ -0,0 +1,173 @@
+/* { dg-options "-O2" } */
+
+/* N1150 5.1 Conversion between decimal floating integer.
+ C99 6.3.1.4(1a) New.
+ These should all be folded at compile time. */
+
+#include "dfp-dbg.h"
+
+#ifdef __cplusplus
+#define BOOL bool
+#else
+#define BOOL _Bool
+#endif
+
+extern void link_error (void);
+
+int
+main ()
+{
+ _Decimal32 d32;
+ _Decimal64 d64;
+ _Decimal128 d128;
+ unsigned int ui;
+ unsigned long ul;
+ unsigned long long ull;
+ int si;
+ long sl;
+ long long sll;
+ BOOL b;
+
+ /* C99 Section 6.7.2 Type specifiers. Type _Bool is
+ mentioned in this section. Conversions between
+ BOOL and DFP types. */
+
+ /* Decimal float to unsigned integer. */
+ d32 = 456.789df;
+ d64 = 23.456789dd;
+ d128 = 1234.5678dl;
+
+ ui = d32;
+ if (ui != 456U)
+ link_error ();
+ ul = d32;
+ if (ul != 456UL)
+ link_error ();
+ ull = d32;
+ if (ull != 456ULL)
+ link_error ();
+
+ ui = d64;
+ if (ui != 23U)
+ link_error ();
+ ul = d64;
+ if (ul != 23UL)
+ link_error ();
+ ull = d64;
+ if (ull != 23ULL)
+ link_error ();
+
+ ui = d128;
+ if (ui != 1234U)
+ link_error ();
+ ul = d128;
+ if (ul != 1234UL)
+ link_error ();
+ ull = d128;
+ if (ull != 1234ULL)
+ link_error ();
+
+ /* Decimal float to signed integer. */
+
+ /* Decimal float to BOOL. */
+ d32 = 1.23df;
+ d64 = -3.4dd;
+ d128 = 0.00003dl;
+
+ b = d32;
+ if (!b)
+ link_error ();
+ b = d64;
+ if (!b)
+ link_error ();
+ b = d128;
+ if (!b)
+ link_error ();
+
+ /* Unsigned integer to decimal float. */
+ ui = 987U;
+ ul = 345678UL;
+ ull = 1234567ULL;
+
+ d32 = ui;
+ if (d32 != 987.0df)
+ link_error ();
+ d32 = ul;
+ if (d32 != 345678.0df)
+ link_error ();
+ d32 = ull;
+ if (d32 != 1234567.df)
+ link_error ();
+
+ d64 = ui;
+ if (d64 != 987.0dd)
+ link_error ();
+ d64 = ul;
+ if (d64 != 345678.0dd)
+ link_error ();
+ d64 = ull;
+ if (d64 != 1234567.dd)
+ link_error ();
+
+ d128 = ui;
+ if (d128 != 987.0dl)
+ link_error ();
+ d128 = ul;
+ if (d128 != 345678.0dl)
+ link_error ();
+ d128 = ull;
+ if (d128 != 1234567.dl)
+ link_error ();
+
+ /* Signed integer to decimal float. */
+ si = -987;
+ sl = -345678;
+ sll = -1234567;
+
+ d32 = si;
+ if (d32 != -987.0df)
+ link_error ();
+ d32 = sl;
+ if (d32 != -345678.0df)
+ link_error ();
+ d32 = sll;
+ if (d32 != -1234567.df)
+ link_error ();
+
+ d64 = si;
+ if (d64 != -987.0dd)
+ link_error ();
+ d64 = sl;
+ if (d64 != -345678.0dd)
+ link_error ();
+ d64 = sll;
+ if (d64 != -1234567.dd)
+ link_error ();
+
+ d128 = si;
+ if (d128 != -987.0dl)
+ link_error ();
+ d128 = sl;
+ if (d128 != -345678.0dl)
+ link_error ();
+ d128 = sll;
+ if (d128 != -1234567.dl)
+ link_error ();
+
+ /* BOOL to decimal float. */
+ d32 = 0.0DF;
+ d64 = 0.0DD;
+ d128 = 0.0DL;
+
+ b = d32;
+ if (b)
+ link_error ();
+ b = d64;
+ if (b)
+ link_error ();
+ b = d128;
+ if (b)
+ link_error ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/convert-int-max-fold.c b/gcc/testsuite/c-c++-common/dfp/convert-int-max-fold.c
new file mode 100644
index 000000000..3f6faae34
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/convert-int-max-fold.c
@@ -0,0 +1,148 @@
+/* { dg-options "-O2 -w" } */
+
+/* N1150 5.1 Conversions from decimal float to integer. */
+
+/* Test decimal float to integer conversions for values at the limit of
+ what will fit into the destination type. This assumes 32-bit int and
+ 64-bit long long (there's a check for that below). This version tests
+ conversions during compilation. */
+
+#include "dfp-dbg.h"
+
+extern void link_error (void);
+
+void
+doit ()
+{
+ _Decimal32 d32;
+ _Decimal64 d64;
+ _Decimal128 d128;
+ int si;
+ unsigned int ui;
+ long long sll;
+ unsigned long long ull;
+
+ /* _Decimal32 to int. */
+
+ d32 = 2147483.E3DF;
+ si = d32;
+ if (si != 2147483000)
+ link_error ();
+
+ d32 = -2147483.E3DF;
+ si = d32;
+ if (si != -2147483000)
+ link_error ();
+
+ /* _Decimal32 to unsigned int. */
+
+ d32 = 4.294967E9DF;
+ ui = d32;
+ if (ui != 4294967000U)
+ link_error ();
+
+ /* _Decimal32 to long long. */
+
+ d32 = 922.3372E16DF;
+ sll = d32;
+ if (sll != 9223372000000000000LL)
+ link_error ();
+
+ d32 = -92233.72E14DF;
+ sll = d32;
+ if (sll != -9223372000000000000LL)
+ link_error ();
+
+ /* _Decimal32 to unsigned long long. */
+
+ d32 = 0.1844674E20DF;
+ ull = d32;
+ if (ull != 18446740000000000000ULL)
+ link_error ();
+
+ /* _Decimal64 to int. */
+
+ d64 = 2.147483647E9DD;
+ si = d64;
+ if (si != 2147483647)
+ link_error ();
+
+ d64 = -2147483648.DD;
+ si = d64;
+ if (si != -2147483648)
+ link_error ();
+
+ /* _Decimal64 to unsigned int. */
+
+ d64 = 42949.67295E5DD;
+ ui = d64;
+ if (ui != 4294967295)
+ link_error ();
+
+ /* _Decimal64 to long long. */
+
+ d64 = 9.223372036854775E18DD;
+ sll = d64;
+ if (sll != 9223372036854775000LL)
+ link_error ();
+
+ d64 = -92233720.36854775E11DD;
+ sll = d64;
+ if (sll != -9223372036854775000LL)
+ link_error ();
+
+ /* _Decimal64 to unsigned long long. */
+ d64 = 1844674407370955.E4DD;
+ ull = d64;
+ if (ull != 18446744073709550000ULL)
+ link_error ();
+
+ /* _Decimal128 to int. */
+
+ d128 = 2.147483647E9DL;
+ si = d128;
+ if (si != 2147483647)
+ link_error ();
+
+ d128 = -2147483648.DL;
+ si = d128;
+ if (si != -2147483648)
+ link_error ();
+
+ /* _Decimal128 to unsigned int. */
+
+ d128 = 4294.967295E6DL;
+ ui = d128;
+ if (ui != 4294967295)
+ link_error ();
+
+ /* _Decimal128 to long long. */
+
+ d128 = 9223372036854775807.DL;
+ sll = d128;
+ if (sll != 9223372036854775807LL)
+ link_error ();
+
+ d128 = -9.223372036854775808E19DL;
+ sll = d128;
+ if (sll != -9223372036854775807LL - 1LL)
+ link_error ();
+
+ /* _Decimal128 to unsigned long long. */
+ d128 = 18446744073709551615.DL;
+ ull = d128;
+ if (ull != 18446744073709551615ULL)
+ link_error ();
+}
+
+int
+main ()
+{
+ /* This test assumes 32-bit int and 64-bit long long. */
+
+ if (sizeof (int) != 4 || sizeof (long long) != 8)
+ return 0;
+
+ doit ();
+ return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/convert-int-max.c b/gcc/testsuite/c-c++-common/dfp/convert-int-max.c
new file mode 100644
index 000000000..724627d37
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/convert-int-max.c
@@ -0,0 +1,146 @@
+/* { dg-options "-O0 -w" } */
+
+/* N1150 5.1 Conversions from decimal float to integer. */
+
+/* Test decimal float to integer conversions for values at the limit of
+ what will fit into the destination type. This assumes 32-bit int and
+ 64-bit long long (there's a check for that below). */
+
+#include "dfp-dbg.h"
+
+volatile _Decimal32 d32;
+volatile _Decimal64 d64;
+volatile _Decimal128 d128;
+volatile int si;
+volatile unsigned int ui;
+volatile long long sll;
+volatile unsigned long long ull;
+
+void
+doit ()
+{
+ /* _Decimal32 to int. */
+
+ d32 = 2147483.E3DF;
+ si = d32;
+ if (si != 2147483000)
+ FAILURE
+
+ d32 = -2147483.E3DF;
+ si = d32;
+ if (si != -2147483000)
+ FAILURE
+
+ /* _Decimal32 to unsigned int. */
+
+ d32 = 4.294967E9DF;
+ ui = d32;
+ if (ui != 4294967000U)
+ FAILURE
+
+ /* _Decimal32 to long long. */
+
+ d32 = 922.3372E16DF;
+ sll = d32;
+ if (sll != 9223372000000000000LL)
+ FAILURE
+
+ d32 = -92233.72E14DF;
+ sll = d32;
+ if (sll != -9223372000000000000LL)
+ FAILURE
+
+ /* _Decimal32 to unsigned long long. */
+
+ d32 = .1844674E20DF;
+ ull = d32;
+ if (ull != 18446740000000000000ULL)
+ FAILURE
+
+ /* _Decimal64 to int. */
+
+ d64 = 2.147483647E9DD;
+ si = d64;
+ if (si != 2147483647)
+ FAILURE
+
+ d64 = -2147483648.DD;
+ si = d64;
+ if (si != -2147483648)
+ FAILURE
+
+ /* _Decimal64 to unsigned int. */
+
+ d64 = 42949.67295E5DD;
+ ui = d64;
+ if (ui != 4294967295)
+ FAILURE
+
+ /* _Decimal64 to long long. */
+
+ d64 = 9.223372036854775E18DD;
+ sll = d64;
+ if (sll != 9223372036854775000LL)
+ FAILURE
+
+ d64 = -92233720.36854775E11DD;
+ sll = d64;
+ if (sll != -9223372036854775000LL)
+ FAILURE
+
+ /* _Decimal64 to unsigned long long. */
+ d64 = 1844674407370955.E4DD;
+ ull = d64;
+ if (ull != 18446744073709550000ULL)
+ FAILURE
+
+ /* _Decimal128 to int. */
+
+ d128 = 2.147483647E9DL;
+ si = d128;
+ if (si != 2147483647)
+ FAILURE
+
+ d128 = -2147483648.DL;
+ si = d128;
+ if (si != -2147483648)
+ FAILURE
+
+ /* _Decimal128 to unsigned int. */
+
+ d128 = 4294.967295E6DL;
+ ui = d128;
+ if (ui != 4294967295)
+ FAILURE
+
+ /* _Decimal128 to long long. */
+
+ d128 = 9223372036854775807.DL;
+ sll = d128;
+ if (sll != 9223372036854775807LL)
+ FAILURE
+
+ d128 = -9.223372036854775808E19DL;
+ sll = d128;
+ if (sll != -9223372036854775807LL - 1LL)
+ FAILURE
+
+ /* _Decimal128 to unsigned long long. */
+ d128 = 18446744073709551615.DL;
+ ull = d128;
+ if (ull != 18446744073709551615ULL)
+ FAILURE
+}
+
+int
+main ()
+{
+ /* This test assumes 32-bit int and 64-bit long long. */
+
+ if (sizeof (int) != 4 || sizeof (long long) != 8)
+ return 0;
+
+ doit ();
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/convert-int-saturate.c b/gcc/testsuite/c-c++-common/dfp/convert-int-saturate.c
new file mode 100644
index 000000000..c92502d56
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/convert-int-saturate.c
@@ -0,0 +1,64 @@
+/* N1150 5.1 Conversion between decimal floating integer.
+ C99 6.3.1.4(1a) New.
+ Test integer saturation. */
+
+#ifndef __STDC_WANT_DEC_FP__
+#define __STDC_WANT_DEC_FP__ 1
+#endif
+
+#include "dfp-dbg.h"
+#include <float.h>
+#include <limits.h>
+
+volatile _Decimal32 d32;
+volatile _Decimal64 d64;
+volatile _Decimal128 d128;
+
+volatile signed int si;
+volatile unsigned int usi;
+volatile unsigned long long udi;
+
+int
+main ()
+{
+
+ /* Unsigned. */
+ usi = DEC32_MAX; /* { dg-warning "overflow in implicit constant conversion" } */
+ if (usi != UINT_MAX)
+ FAILURE
+
+ usi = DEC64_MAX; /* { dg-warning "overflow in implicit constant conversion" } */
+ if (usi != UINT_MAX)
+ FAILURE
+
+ usi = DEC128_MAX; /* { dg-warning "overflow in implicit constant conversion" } */
+ if (usi != UINT_MAX)
+ FAILURE
+
+ /* Signed. */
+ si = DEC32_MAX; /* { dg-warning "overflow in implicit constant conversion" } */
+ if (si != INT_MAX)
+ FAILURE
+
+ si = DEC64_MAX; /* { dg-warning "overflow in implicit constant conversion" } */
+ if (si != INT_MAX)
+ FAILURE
+
+ si = DEC128_MAX; /* { dg-warning "overflow in implicit constant conversion" } */
+ if (si != INT_MAX)
+ FAILURE
+
+ si = - DEC32_MAX; /* { dg-warning "overflow in implicit constant conversion" } */
+ if (si != INT_MIN)
+ FAILURE
+
+ si = - DEC64_MAX; /* { dg-warning "overflow in implicit constant conversion" } */
+ if (si != INT_MIN)
+ FAILURE
+
+ si = - DEC128_MAX; /* { dg-warning "overflow in implicit constant conversion" } */
+ if (si != INT_MIN)
+ FAILURE
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/convert-int.c b/gcc/testsuite/c-c++-common/dfp/convert-int.c
new file mode 100644
index 000000000..1525d5760
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/convert-int.c
@@ -0,0 +1,199 @@
+/* { dg-options "-O0" } */
+
+/* N1150 5.1 Conversion between decimal floating types and integer.
+ C99 6.3.1.4(1a) New. */
+
+#include "dfp-dbg.h"
+
+#ifdef __cplusplus
+#define BOOL bool
+#else
+#define BOOL _Bool
+#endif
+
+_Decimal32 d32;
+_Decimal64 d64;
+_Decimal128 d128;
+unsigned int ui;
+unsigned long ul;
+unsigned long long ull;
+int si;
+long sl;
+long long sll;
+BOOL b;
+
+void
+init_dfp_1 (void)
+{
+ d32 = 456.789df;
+ d64 = 23.456789dd;
+ d128 = 1234.5678dl;
+}
+void
+init_dfp_2 (void)
+{
+ d32 = 1.23df;
+ d64 = -3.4dd;
+ d128 = 0.00003dl;
+}
+
+void
+init_dfp_3 (void)
+{
+ d32 = 0.0DF;
+ d64 = 0.0DD;
+ d128 = 0.0DL;
+}
+
+void
+init_unsigned_int (void)
+{
+ ui = 987U;
+ ul = 345678UL;
+ ull = 1234567ULL;
+}
+
+void
+init_signed_int (void)
+{
+ si = -987;
+ sl = -345678;
+ sll = -1234567;
+}
+
+int
+main ()
+{
+ /* C99 Section 6.7.2 Type specifiers. Type _Bool is
+ mentioned in this section. Conversions between
+ BOOL and DFP types. */
+
+ /* Decimal float to unsigned integer. */
+ init_dfp_1 ();
+
+ ui = d32;
+ if (ui != 456U)
+ FAILURE
+ ul = d32;
+ if (ul != 456UL)
+ FAILURE
+ ull = d32;
+ if (ull != 456ULL)
+ FAILURE
+
+ ui = d64;
+ if (ui != 23U)
+ FAILURE
+ ul = d64;
+ if (ul != 23UL)
+ FAILURE
+ ull = d64;
+ if (ull != 23ULL)
+ FAILURE
+
+ ui = d128;
+ if (ui != 1234U)
+ FAILURE
+ ul = d128;
+ if (ul != 1234UL)
+ FAILURE
+ ull = d128;
+ if (ull != 1234ULL)
+ FAILURE
+
+ /* Decimal float to signed integer. */
+
+ /* Decimal float to BOOL. */
+ init_dfp_2 ();
+
+ b = d32;
+ if (!b)
+ FAILURE
+ b = d64;
+ if (!b)
+ FAILURE
+ b = d128;
+ if (!b)
+ FAILURE
+
+ /* Unsigned integer to decimal float. */
+ init_unsigned_int ();
+
+ d32 = ui;
+ if (d32 != 987.0df)
+ FAILURE
+ d32 = ul;
+ if (d32 != 345678.0df)
+ FAILURE
+ d32 = ull;
+ if (d32 != 1234567.df)
+ FAILURE
+
+ d64 = ui;
+ if (d64 != 987.0dd)
+ FAILURE
+ d64 = ul;
+ if (d64 != 345678.0dd)
+ FAILURE
+ d64 = ull;
+ if (d64 != 1234567.dd)
+ FAILURE
+
+ d128 = ui;
+ if (d128 != 987.0dl)
+ FAILURE
+ d128 = ul;
+ if (d128 != 345678.0dl)
+ FAILURE
+ d128 = ull;
+ if (d128 != 1234567.dl)
+ FAILURE
+
+ /* Signed integer to decimal float. */
+ init_signed_int ();
+
+ d32 = si;
+ if (d32 != -987.0df)
+ FAILURE
+ d32 = sl;
+ if (d32 != -345678.0df)
+ FAILURE
+ d32 = sll;
+ if (d32 != -1234567.df)
+ FAILURE
+
+ d64 = si;
+ if (d64 != -987.0dd)
+ FAILURE
+ d64 = sl;
+ if (d64 != -345678.0dd)
+ FAILURE
+ d64 = sll;
+ if (d64 != -1234567.dd)
+ FAILURE
+
+ d128 = si;
+ if (d128 != -987.0dl)
+ FAILURE
+ d128 = sl;
+ if (d128 != -345678.0dl)
+ FAILURE
+ d128 = sll;
+ if (d128 != -1234567.dl)
+ FAILURE
+
+ /* BOOL to decimal float. */
+ init_dfp_3 ();
+
+ b = d32;
+ if (b)
+ FAILURE
+ b = d64;
+ if (b)
+ FAILURE
+ b = d128;
+ if (b)
+ FAILURE
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/convert.h b/gcc/testsuite/c-c++-common/dfp/convert.h
new file mode 100644
index 000000000..304164ff6
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/convert.h
@@ -0,0 +1,462 @@
+#include "dfp-dbg.h"
+
+/* Macros are set up to skip using long double, which doesn't necessarily
+ map to TF mode. If there's a reason to skip those for a test, the
+ test itself can define USE_TF to be zero. */
+#ifndef USE_TF
+#define USE_TF 1
+#endif
+
+/* Provide more information with FAILURE than what is available with
+ the version of that macro in dfp-dbg.h. */
+
+#undef FAILURE
+#if defined(DBG) || defined(DBG2)
+#include <stdio.h>
+#define FAILURE(NUM) \
+ { printf ("failed for test %s\n", NUM); failures++; }
+#else
+#define FAILURE(N) __builtin_abort ();
+#endif
+
+/* This is useful when modifying the test to make sure that tests are
+ actually run. */
+#if defined(DBG2)
+#define REPORT(NUM) \
+ { printf ("%s\n", NUM); }
+#else
+#define REPORT(N) ;
+#endif
+
+#define CONVERT_VALID(NUM,FROM,TO,FROMVAL,TOVAL,DIFF) \
+void \
+convert_##NUM (void) \
+{ \
+ REPORT(#NUM " " #FROMVAL) \
+ FROM = FROMVAL; \
+ TO = FROM; \
+ if (TO < (TOVAL - DIFF) || TO > (TOVAL + DIFF)) \
+ FAILURE (#NUM); \
+}
+
+#define CONVERT_TO_PINF(NUM,FROM,TO,FROMVAL,TOSUFFIX) \
+void \
+convert_##NUM (void) \
+{ \
+ REPORT(#NUM " " #FROMVAL) \
+ FROM = FROMVAL; \
+ TO = FROM; \
+ if (__builtin_isinf##TOSUFFIX (TO) == 0) \
+ FAILURE (#NUM " pinf: isinf"); \
+ if (__builtin_signbit##TOSUFFIX (TO) != 0) \
+ FAILURE (#NUM " pinf: sign"); \
+}
+
+#define CONVERT_TO_MINF(NUM,FROM,TO,FROMVAL,TOSUFFIX) \
+void \
+convert_##NUM (void) \
+{ \
+ REPORT(#NUM " " #FROMVAL) \
+ FROM = FROMVAL; \
+ TO = FROM; \
+ if (__builtin_isinf##TOSUFFIX (TO) == 0) \
+ FAILURE (#NUM " pinf: isinf"); \
+ if (__builtin_signbit##TOSUFFIX (TO) == 0) \
+ FAILURE (#NUM " pinf: sign"); \
+}
+
+#define CONVERT_TO_PZERO(NUM,FROM,TO,FROMVAL,TOVAL,TOSUFFIX) \
+void \
+convert_##NUM (void) \
+{ \
+ REPORT(#NUM " " #FROMVAL) \
+ FROM = FROMVAL; \
+ TO = FROM; \
+ if (TO != TOVAL) \
+ FAILURE (#NUM "_pzero: zero") \
+ if (__builtin_signbit##TOSUFFIX (TO) != 0) \
+ FAILURE (#NUM " _pzero: sign"); \
+}
+
+#define CONVERT_TO_MZERO(NUM,FROM,TO,FROMVAL,TOVAL,TOSUFFIX) \
+void \
+convert_##NUM (void) \
+{ \
+ REPORT(#NUM " " #FROMVAL) \
+ FROM = FROMVAL; \
+ TO = FROM; \
+ if (TO != TOVAL) \
+ FAILURE (#NUM "_mzero: zero") \
+ if (__builtin_signbit##TOSUFFIX (TO) == 0) \
+ FAILURE (#NUM " _mzero: sign"); \
+}
+
+#define CONVERT_NAN(NUM,FROM,TO,FROMSUFFIX,TOSUFFIX) \
+void \
+convert_##NUM##_nan (void) \
+{ \
+ REPORT(#NUM "_nan") \
+ FROM = __builtin_nan##FROMSUFFIX (""); \
+ TO = FROM; \
+ if (__builtin_isnan##TOSUFFIX (TO) == 0) \
+ FAILURE (#NUM " nan"); \
+}
+
+#define CONVERT_PINF(NUM,FROM,TO,FROMSUFFIX,TOSUFFIX) \
+void \
+convert_##NUM##_pinf (void) \
+{ \
+ REPORT (#NUM "_pinf") \
+ FROM = __builtin_inf##FROMSUFFIX (); \
+ TO = FROM; \
+ if (__builtin_isinf##TOSUFFIX (TO) == 0) \
+ FAILURE (#NUM " pinf: isinf"); \
+ if (__builtin_signbit##TOSUFFIX (TO) != 0) \
+ FAILURE (#NUM " pinf: sign"); \
+}
+
+#define CONVERT_MINF(NUM,FROM,TO,FROMSUFFIX,TOSUFFIX) \
+void \
+convert_##NUM##_minf (void) \
+{ \
+ REPORT (#NUM "_minf") \
+ FROM = -__builtin_inf##FROMSUFFIX (); \
+ TO = FROM; \
+ if (__builtin_isinf##TOSUFFIX (TO) == 0) \
+ FAILURE (#NUM " minf: isinf"); \
+ if (__builtin_signbit##TOSUFFIX (TO) == 0) \
+ FAILURE (#NUM " minf: sign"); \
+}
+
+#define CONVERT_PZERO(NUM,FROM,TO,FROMVALUE,TOVALUE,TOSUFFIX) \
+void \
+convert_##NUM##_pzero (void) \
+{ \
+ REPORT (#NUM "_pzero") \
+ FROM = FROMVALUE; \
+ TO = FROM; \
+ if (TO != TOVALUE) \
+ FAILURE (#NUM "pzero: zero") \
+ if (__builtin_signbit##TOSUFFIX (TO) != 0) \
+ FAILURE (#NUM " pzero: sign"); \
+}
+
+#define CONVERT_MZERO(NUM,FROM,TO,FROMVALUE,TOVALUE,TOSUFFIX) \
+void \
+convert_##NUM##_mzero (void) \
+{ \
+ REPORT (#NUM "_mzero") \
+ FROM = FROMVALUE; \
+ TO = FROM; \
+ if (TO != TOVALUE) \
+ FAILURE (#NUM "mzero: zero") \
+ if (__builtin_signbit##TOSUFFIX (TO) == 0) \
+ FAILURE (#NUM " mzero: sign"); \
+}
+
+#define CONVERT_VALID_NOTF(NUM,VAL,DIFF) \
+CONVERT_VALID (NUM##_sdsf, sd, sf, VAL##df, VAL##f, DIFF##f) \
+CONVERT_VALID (NUM##_sddf, sd, df, VAL##df, VAL, DIFF) \
+CONVERT_VALID (NUM##_ddsf, dd, sf, VAL##dd, VAL##f, DIFF##f) \
+CONVERT_VALID (NUM##_dddf, dd, df, VAL##dd, VAL, DIFF) \
+CONVERT_VALID (NUM##_tdsf, td, sf, VAL##dl, VAL##f, DIFF##f) \
+CONVERT_VALID (NUM##_tddf, td, df, VAL##dl, VAL, DIFF) \
+CONVERT_VALID (NUM##_sfsd, sf, sd, VAL##f, VAL##df, DIFF##df) \
+CONVERT_VALID (NUM##_sfdd, sf, dd, VAL##f, VAL##dd, DIFF##dd) \
+CONVERT_VALID (NUM##_sftd, sf, td, VAL##f, VAL##dl, DIFF##dl) \
+CONVERT_VALID (NUM##_dfsd, df, sd, VAL, VAL##df, DIFF##df) \
+CONVERT_VALID (NUM##_dfdd, df, dd, VAL, VAL##dd, DIFF##dd) \
+CONVERT_VALID (NUM##_dftd, df, td, VAL, VAL##dl, DIFF##dl) \
+CONVERT_VALID (NUM##_sddd, sd, dd, VAL##df, VAL##dd, DIFF##dd) \
+CONVERT_VALID (NUM##_sdtd, sd, dd, VAL##df, VAL##dd, DIFF##dd) \
+CONVERT_VALID (NUM##_ddsd, dd, sd, VAL##dd, VAL##df, DIFF##dd) \
+CONVERT_VALID (NUM##_ddtd, dd, td, VAL##dd, VAL##dl, DIFF##dl) \
+CONVERT_VALID (NUM##_tdsd, td, sd, VAL##dl, VAL##df, DIFF##df) \
+CONVERT_VALID (NUM##_tddd, td, dd, VAL##dl, VAL##dd, DIFF##dd)
+
+#if USE_TF == 0
+#define CONVERT_VALID_TF(NUM,VAL,DIFF)
+#else
+#define CONVERT_VALID_TF(NUM,VAL,DIFF) \
+CONVERT_VALID (NUM##_sdtf, sd, tf, VAL##df, VAL##l, DIFF##l) \
+CONVERT_VALID (NUM##_tdtf, td, tf, VAL##dl, VAL##l, DIFF##l) \
+CONVERT_VALID (NUM##_ddtf, dd, tf, VAL##dd, VAL##l, DIFF##l) \
+CONVERT_VALID (NUM##_tfsd, tf, sd, VAL##l, VAL##df, DIFF##df) \
+CONVERT_VALID (NUM##_tfdd, tf, dd, VAL##l, VAL##dd, DIFF##dd) \
+CONVERT_VALID (NUM##_tftd, tf, td, VAL##l, VAL##dl, DIFF##dl)
+#endif
+
+#define CONVERT_VALID_ALL(NUM,VAL,DIFF) \
+ CONVERT_VALID_NOTF(NUM,VAL,DIFF) \
+ CONVERT_VALID_TF(NUM,VAL,DIFF)
+
+#define CALL_VALID_NOTF(NUM) \
+ convert_##NUM##_sdsf (); \
+ convert_##NUM##_sddf (); \
+ convert_##NUM##_ddsf (); \
+ convert_##NUM##_dddf (); \
+ convert_##NUM##_tdsf (); \
+ convert_##NUM##_tddf (); \
+ convert_##NUM##_sfsd (); \
+ convert_##NUM##_sfdd (); \
+ convert_##NUM##_sftd (); \
+ convert_##NUM##_dfsd (); \
+ convert_##NUM##_dfdd (); \
+ convert_##NUM##_dftd (); \
+ convert_##NUM##_sddd (); \
+ convert_##NUM##_sdtd (); \
+ convert_##NUM##_ddsd (); \
+ convert_##NUM##_ddtd (); \
+ convert_##NUM##_tdsd (); \
+ convert_##NUM##_tddd ();
+
+#if USE_TF == 0
+#define CALL_VALID_TF(NUM)
+#else
+#define CALL_VALID_TF(NUM) \
+ convert_##NUM##_sdtf (); \
+ convert_##NUM##_ddtf (); \
+ convert_##NUM##_tdtf (); \
+ convert_##NUM##_tfsd (); \
+ convert_##NUM##_tfdd (); \
+ convert_##NUM##_tftd ();
+#endif
+
+#define CALL_VALID_ALL(NUM) \
+ CALL_VALID_NOTF(NUM) \
+ CALL_VALID_TF(NUM)
+
+#define CONVERT_ZEROES(NUM,FROM,TO,FROMVALUE,TOVALUE,TOSUFFIX) \
+CONVERT_PZERO(NUM, FROM, TO, FROMVALUE, TOVALUE, TOSUFFIX) \
+CONVERT_MZERO(NUM, FROM, TO, -FROMVALUE, -TOVALUE, TOSUFFIX)
+
+#define CONVERT_ZEROES_NOTF(NUM) \
+CONVERT_ZEROES (NUM##_sdsf, sd, sf, 0.0df, 0.0f, f) \
+CONVERT_ZEROES (NUM##_sddf, sd, df, 0.0df, 0.0, ) \
+CONVERT_ZEROES (NUM##_ddsf, dd, sf, 0.0dd, 0.0f, f) \
+CONVERT_ZEROES (NUM##_dddf, dd, df, 0.0dd, 0.0, ) \
+CONVERT_ZEROES (NUM##_tdsf, td, sf, 0.0dl, 0.0f, f) \
+CONVERT_ZEROES (NUM##_tddf, td, df, 0.0dl, 0.0, ) \
+CONVERT_ZEROES (NUM##_sfsd, sf, sd, 0.0f, 0.0df, d32) \
+CONVERT_ZEROES (NUM##_sfdd, sf, dd, 0.0f, 0.0dd, d64) \
+CONVERT_ZEROES (NUM##_sftd, sf, td, 0.0f, 0.0dl, d128) \
+CONVERT_ZEROES (NUM##_dfsd, df, sd, 0.0, 0.0df, d32) \
+CONVERT_ZEROES (NUM##_dfdd, df, dd, 0.0, 0.0dd, d64) \
+CONVERT_ZEROES (NUM##_dftd, df, td, 0.0, 0.0dl, d128) \
+CONVERT_ZEROES (NUM##_sddd, sd, dd, 0.0df, 0.0dd, d64) \
+CONVERT_ZEROES (NUM##_sdtd, sd, td, 0.0dl, 0.0dl, d128) \
+CONVERT_ZEROES (NUM##_ddsd, dd, sd, 0.0dd, 0.0df, d32) \
+CONVERT_ZEROES (NUM##_ddtd, dd, td, 0.0dd, 0.0dl, d128) \
+CONVERT_ZEROES (NUM##_tdsd, td, sd, 0.0dl, 0.0df, d32) \
+CONVERT_ZEROES (NUM##_tddd, td, dd, 0.0dl, 0.0dd, d64)
+
+#if USE_TF == 0
+#define CONVERT_ZEROES_TF(NUM)
+#else
+#define CONVERT_ZEROES_TF(NUM) \
+CONVERT_ZEROES (NUM##_sdtf, sd, tf, 0.0df, 0.0l, l) \
+CONVERT_ZEROES (NUM##_ddtf, dd, tf, 0.0dd, 0.0l, l) \
+CONVERT_ZEROES (NUM##_tdtf, td, tf, 0.0dl, 0.0l, l) \
+CONVERT_ZEROES (NUM##_tfsd, tf, sd, 0.0l, 0.0df, d32) \
+CONVERT_ZEROES (NUM##_tfdd, tf, dd, 0.0l, 0.0dd, d64) \
+CONVERT_ZEROES (NUM##_tftd, tf, td, 0.0l, 0.0dl, d128)
+#endif
+
+#define CONVERT_ZEROES_ALL(NUM) \
+ CONVERT_ZEROES_NOTF(NUM) \
+ CONVERT_ZEROES_TF(NUM)
+
+#define CALL_ZEROES(NUM) \
+ convert_##NUM##_pzero (); \
+ convert_##NUM##_mzero ();
+
+#define CALL_ZEROES_NOTF(NUM) \
+ CALL_ZEROES (NUM##_sdsf) \
+ CALL_ZEROES (NUM##_sddf) \
+ CALL_ZEROES (NUM##_ddsf) \
+ CALL_ZEROES (NUM##_dddf) \
+ CALL_ZEROES (NUM##_tdsf) \
+ CALL_ZEROES (NUM##_tddf) \
+ CALL_ZEROES (NUM##_sfsd) \
+ CALL_ZEROES (NUM##_sfdd) \
+ CALL_ZEROES (NUM##_sftd) \
+ CALL_ZEROES (NUM##_dfsd) \
+ CALL_ZEROES (NUM##_dfdd) \
+ CALL_ZEROES (NUM##_dftd) \
+ CALL_ZEROES (NUM##_sddd) \
+ CALL_ZEROES (NUM##_sdtd) \
+ CALL_ZEROES (NUM##_ddsd) \
+ CALL_ZEROES (NUM##_ddtd) \
+ CALL_ZEROES (NUM##_tdsd) \
+ CALL_ZEROES (NUM##_tddd)
+
+#if USE_TF == 0
+#define CALL_ZEROES_TF(NUM)
+#else
+#define CALL_ZEROES_TF(NUM) \
+ CALL_ZEROES (NUM##_sdtf) \
+ CALL_ZEROES (NUM##_ddtf) \
+ CALL_ZEROES (NUM##_tdtf) \
+ CALL_ZEROES (NUM##_tfsd) \
+ CALL_ZEROES (NUM##_tfdd) \
+ CALL_ZEROES (NUM##_tftd)
+#endif
+
+#define CALL_ZEROES_ALL(NUM) \
+ CALL_ZEROES_NOTF(NUM) \
+ CALL_ZEROES_TF(NUM)
+
+#define CONVERT_INF(NUM,FROM,TO,FROMSUFFIX,TOSUFFIX) \
+CONVERT_PINF (NUM, FROM, TO, FROMSUFFIX, TOSUFFIX) \
+CONVERT_MINF (NUM, FROM, TO, FROMSUFFIX, TOSUFFIX)
+
+#define CONVERT_INF_NOTF(NUM) \
+CONVERT_INF (NUM##_sdsf, sd, sf, d32, f) \
+CONVERT_INF (NUM##_sddf, sd, df, d32, ) \
+CONVERT_INF (NUM##_ddsf, dd, sf, d64, f) \
+CONVERT_INF (NUM##_dddf, dd, df, d64, ) \
+CONVERT_INF (NUM##_tdsf, td, sf, d128, f) \
+CONVERT_INF (NUM##_tddf, td, df, d128, ) \
+CONVERT_INF (NUM##_sfsd, sf, sd, f, d32) \
+CONVERT_INF (NUM##_sfdd, sf, dd, f, d64) \
+CONVERT_INF (NUM##_sftd, sf, td, f, d128) \
+CONVERT_INF (NUM##_dfsd, df, sd, , d32) \
+CONVERT_INF (NUM##_dfdd, df, dd, , d64) \
+CONVERT_INF (NUM##_dftd, df, td, , d128) \
+CONVERT_INF (NUM##_sddd, sd, dd, d32, d64) \
+CONVERT_INF (NUM##_sdtd, sd, td, d32, d128) \
+CONVERT_INF (NUM##_ddsd, dd, sd, d64, d32) \
+CONVERT_INF (NUM##_ddtd, dd, td, d64, d128) \
+CONVERT_INF (NUM##_tdsd, td, sd, d128, d32) \
+CONVERT_INF (NUM##_tddd, td, dd, d128, d64)
+
+#if USE_TF == 0
+#define CONVERT_INF_TF(NUM)
+#else
+#define CONVERT_INF_TF(NUM) \
+CONVERT_INF (NUM##_sdtf, sd, tf, d32, l) \
+CONVERT_INF (NUM##_ddtf, dd, tf, d64, l) \
+CONVERT_INF (NUM##_tdtf, td, tf, d128, l) \
+CONVERT_INF (NUM##_tfsd, tf, sd, l, d32) \
+CONVERT_INF (NUM##_tfdd, tf, dd, l, d64) \
+CONVERT_INF (NUM##_tftd, tf, td, l, d128)
+#endif
+
+#define CONVERT_INF_ALL(NUM) \
+ CONVERT_INF_NOTF(NUM) \
+ CONVERT_INF_TF(NUM)
+
+#define CALL_INF(NUM) \
+ convert_##NUM##_pinf (); \
+ convert_##NUM##_minf ();
+
+#define CALL_INF_NOTF(NUM) \
+ CALL_INF (NUM##_sdsf) \
+ CALL_INF (NUM##_sddf) \
+ CALL_INF (NUM##_ddsf) \
+ CALL_INF (NUM##_dddf) \
+ CALL_INF (NUM##_tdsf) \
+ CALL_INF (NUM##_tddf) \
+ CALL_INF (NUM##_sfsd) \
+ CALL_INF (NUM##_sfdd) \
+ CALL_INF (NUM##_sftd) \
+ CALL_INF (NUM##_dfsd) \
+ CALL_INF (NUM##_dfdd) \
+ CALL_INF (NUM##_dftd) \
+ CALL_INF (NUM##_sddd) \
+ CALL_INF (NUM##_sdtd) \
+ CALL_INF (NUM##_ddsd) \
+ CALL_INF (NUM##_ddtd) \
+ CALL_INF (NUM##_tdsd) \
+ CALL_INF (NUM##_tddd)
+
+#if USE_TF == 0
+#define CALL_INF_TF(NUM)
+#else
+#define CALL_INF_TF(NUM) \
+ CALL_INF (NUM##_sdtf) \
+ CALL_INF (NUM##_ddtf) \
+ CALL_INF (NUM##_tdtf) \
+ CALL_INF (NUM##_tfsd) \
+ CALL_INF (NUM##_tfdd) \
+ CALL_INF (NUM##_tftd)
+#endif
+
+#define CALL_INF_ALL(NUM) \
+ CALL_INF_NOTF(NUM) \
+ CALL_INF_TF(NUM)
+
+#define CONVERT_NAN_NOTF(NUM) \
+CONVERT_NAN (NUM##_sdsf, sd, sf, d32, f) \
+CONVERT_NAN (NUM##_sddf, sd, df, d32, ) \
+CONVERT_NAN (NUM##_ddsf, dd, sf, d64, f) \
+CONVERT_NAN (NUM##_dddf, dd, df, d64, ) \
+CONVERT_NAN (NUM##_tdsf, td, sf, d128, f) \
+CONVERT_NAN (NUM##_tddf, td, df, d128, ) \
+CONVERT_NAN (NUM##_sfsd, sf, sd, f, d32) \
+CONVERT_NAN (NUM##_sfdd, sf, dd, f, d64) \
+CONVERT_NAN (NUM##_sftd, sf, td, f, d128) \
+CONVERT_NAN (NUM##_dfsd, df, sd, , d32) \
+CONVERT_NAN (NUM##_dfdd, df, dd, , d64) \
+CONVERT_NAN (NUM##_dftd, df, td, , d128) \
+CONVERT_NAN (NUM##_sddd, sd, dd, d32, d64) \
+CONVERT_NAN (NUM##_sdtd, sd, td, d32, d128) \
+CONVERT_NAN (NUM##_ddsd, dd, sd, d64, d32) \
+CONVERT_NAN (NUM##_ddtd, dd, td, d64, d128) \
+CONVERT_NAN (NUM##_tdsd, td, sd, d128, d32) \
+CONVERT_NAN (NUM##_tddd, td, dd, d128, d64)
+
+#if USE_TF == 0
+#define CONVERT_NAN_TF(NUM)
+#else
+#define CONVERT_NAN_TF(NUM) \
+CONVERT_NAN (NUM##_sdtf, sd, tf, d32, l) \
+CONVERT_NAN (NUM##_ddtf, dd, tf, d64, l) \
+CONVERT_NAN (NUM##_tdtf, td, tf, d128, l) \
+CONVERT_NAN (NUM##_tfsd, tf, sd, l, d32) \
+CONVERT_NAN (NUM##_tfdd, tf, dd, l, d64) \
+CONVERT_NAN (NUM##_tftd, tf, td, l, d128)
+#endif
+
+#define CONVERT_NAN_ALL(NUM) \
+ CONVERT_NAN_NOTF(NUM) \
+ CONVERT_NAN_TF(NUM)
+
+#define CALL_NAN(NUM) \
+ convert_##NUM##_nan ();
+
+#define CALL_NAN_NOTF(NUM) \
+ CALL_NAN (NUM##_sdsf) \
+ CALL_NAN (NUM##_sddf) \
+ CALL_NAN (NUM##_ddsf) \
+ CALL_NAN (NUM##_dddf) \
+ CALL_NAN (NUM##_tdsf) \
+ CALL_NAN (NUM##_tddf) \
+ CALL_NAN (NUM##_sfsd) \
+ CALL_NAN (NUM##_sfdd) \
+ CALL_NAN (NUM##_sftd) \
+ CALL_NAN (NUM##_dfsd) \
+ CALL_NAN (NUM##_dfdd) \
+ CALL_NAN (NUM##_dftd) \
+ CALL_NAN (NUM##_sddd) \
+ CALL_NAN (NUM##_sdtd) \
+ CALL_NAN (NUM##_ddsd) \
+ CALL_NAN (NUM##_ddtd) \
+ CALL_NAN (NUM##_tdsd) \
+ CALL_NAN (NUM##_tddd)
+
+#if USE_TF == 0
+#define CALL_NAN_TF(NUM)
+#else
+#define CALL_NAN_TF(NUM) \
+ CALL_NAN (NUM##_sdtf) \
+ CALL_NAN (NUM##_ddtf) \
+ CALL_NAN (NUM##_tdtf) \
+ CALL_NAN (NUM##_tfsd) \
+ CALL_NAN (NUM##_tfdd) \
+ CALL_NAN (NUM##_tftd)
+#endif
+
+#define CALL_NAN_ALL(NUM) \
+ CALL_NAN_NOTF(NUM) \
+ CALL_NAN_TF(NUM)
diff --git a/gcc/testsuite/c-c++-common/dfp/dfp-dbg.h b/gcc/testsuite/c-c++-common/dfp/dfp-dbg.h
new file mode 100644
index 000000000..cde76c494
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/dfp-dbg.h
@@ -0,0 +1,20 @@
+#ifdef __cplusplus
+typedef float _Decimal32 __attribute__((mode(SD)));
+typedef float _Decimal64 __attribute__((mode(DD)));
+typedef float _Decimal128 __attribute__((mode(TD)));
+
+#define EXTERN extern "C"
+#else
+#define EXTERN extern
+#endif
+
+int failures;
+
+#ifdef DBG
+extern int printf (const char *, ...);
+#define FAILURE { printf ("failed at line %d\n", __LINE__); failures++; }
+#define FINISH if (failures != 0) __builtin_abort (); return 0;
+#else
+#define FAILURE __builtin_abort ();
+#define FINISH return 0;
+#endif
diff --git a/gcc/testsuite/c-c++-common/dfp/func-array.c b/gcc/testsuite/c-c++-common/dfp/func-array.c
new file mode 100644
index 000000000..6d158f355
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/func-array.c
@@ -0,0 +1,157 @@
+/* C99 6.5.2.2 Function calls.
+ Test passing array elements involving decimal floating point types. */
+
+#include "dfp-dbg.h"
+
+/* A handful of functions that return the Nth _Decimal32 argument of
+ an incoming array. */
+
+_Decimal32
+arg0_32 (_Decimal32 args[])
+{
+ return args[0];
+}
+
+_Decimal32
+arg1_32 (_Decimal32 args[])
+{
+ return args[1];
+}
+
+_Decimal32
+arg2_32 (_Decimal32 args[])
+{
+ return args[2];
+}
+
+_Decimal32
+arg3_32 (_Decimal32 args[])
+{
+ return args[3];
+}
+
+_Decimal32
+arg4_32 (_Decimal32 args[])
+{
+ return args[4];
+}
+
+_Decimal32
+arg5_32 (_Decimal32 args[])
+{
+ return args[5];
+}
+
+
+/* A handful of functions that return the Nth _Decimal64 argument of
+ an incoming array. */
+
+_Decimal64
+arg0_64 (_Decimal64 args[])
+{
+ return args[0];
+}
+
+_Decimal64
+arg1_64 (_Decimal64 args[])
+{
+ return args[1];
+}
+
+_Decimal64
+arg2_64 (_Decimal64 args[])
+{
+ return args[2];
+}
+
+_Decimal64
+arg3_64 (_Decimal64 args[])
+{
+ return args[3];
+}
+
+_Decimal64
+arg4_64 (_Decimal64 args[])
+{
+ return args[4];
+}
+
+_Decimal64
+arg5_64 (_Decimal64 args[])
+{
+ return args[5];
+}
+
+
+/* A handful of functions that return the Nth _Decimal128 argument of
+ an incoming array. */
+
+_Decimal128
+arg0_128 (_Decimal128 args[])
+{
+ return args[0];
+}
+
+_Decimal128
+arg1_128 (_Decimal128 args[])
+{
+ return args[1];
+}
+
+_Decimal128
+arg2_128 (_Decimal128 args[])
+{
+ return args[2];
+}
+
+_Decimal128
+arg3_128 (_Decimal128 args[])
+{
+ return args[3];
+}
+
+_Decimal128
+arg4_128 (_Decimal128 args[])
+{
+ return args[4];
+}
+
+_Decimal128
+arg5_128 (_Decimal128 args[])
+{
+ return args[5];
+}
+
+
+int main()
+{
+ _Decimal32 d32[] = { 0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df };
+ _Decimal64 d64[] = { 0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd };
+ _Decimal128 d128[] = { 0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl };
+
+ /* _Decimal32 variants. */
+ if (arg0_32 (d32) != 0.0df) FAILURE
+ if (arg1_32 (d32) != 1.0df) FAILURE
+ if (arg2_32 (d32) != 2.0df) FAILURE
+ if (arg3_32 (d32) != 3.0df) FAILURE
+ if (arg4_32 (d32) != 4.0df) FAILURE
+ if (arg5_32 (d32) != 5.0df) FAILURE
+
+ /* _Decimal64 variants. */
+ if (arg0_64 (d64) != 0.0dd) FAILURE
+ if (arg1_64 (d64) != 1.0dd) FAILURE
+ if (arg2_64 (d64) != 2.0dd) FAILURE
+ if (arg3_64 (d64) != 3.0dd) FAILURE
+ if (arg4_64 (d64) != 4.0dd) FAILURE
+ if (arg5_64 (d64) != 5.0dd) FAILURE
+
+ /* _Decimal128 variants. */
+ if (arg0_128 (d128) != 0.0dl) FAILURE
+ if (arg1_128 (d128) != 1.0dl) FAILURE
+ if (arg2_128 (d128) != 2.0dl) FAILURE
+ if (arg3_128 (d128) != 3.0dl) FAILURE
+ if (arg4_128 (d128) != 4.0dl) FAILURE
+ if (arg5_128 (d128) != 5.0dl) FAILURE
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/func-deref.c b/gcc/testsuite/c-c++-common/dfp/func-deref.c
new file mode 100644
index 000000000..81a48a9f8
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/func-deref.c
@@ -0,0 +1,205 @@
+/* C99 6.5.2.2 Function calls.
+ Test scalar passing and return values involving decimal floating
+ point types and dereferenced pointers. */
+
+#include "dfp-dbg.h"
+
+/* A handful of functions that return their Nth _Decimal32
+ argument. */
+
+_Decimal32 __attribute__((noinline))
+arg0_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2,
+ _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5)
+{
+ return arg0;
+}
+
+_Decimal32 __attribute__((noinline))
+arg1_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2,
+ _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5)
+{
+ return arg1;
+}
+
+_Decimal32 __attribute__((noinline))
+arg2_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2,
+ _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5)
+{
+ return arg2;
+}
+
+_Decimal32 __attribute__((noinline))
+arg3_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2,
+ _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5)
+{
+ return arg3;
+}
+
+_Decimal32 __attribute__((noinline))
+arg4_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2,
+ _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5)
+{
+ return arg4;
+}
+
+_Decimal32 __attribute__((noinline))
+arg5_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2,
+ _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5)
+{
+ return arg5;
+}
+
+
+/* A handful of functions that return their Nth _Decimal64
+ argument. */
+
+_Decimal64 __attribute__((noinline))
+arg0_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2,
+ _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5)
+{
+ return arg0;
+}
+
+_Decimal64 __attribute__((noinline))
+arg1_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2,
+ _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5)
+{
+ return arg1;
+}
+
+_Decimal64 __attribute__((noinline))
+arg2_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2,
+ _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5)
+{
+ return arg2;
+}
+
+_Decimal64 __attribute__((noinline))
+arg3_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2,
+ _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5)
+{
+ return arg3;
+}
+
+_Decimal64 __attribute__((noinline))
+arg4_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2,
+ _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5)
+{
+ return arg4;
+}
+
+_Decimal64 __attribute__((noinline))
+arg5_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2,
+ _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5)
+{
+ return arg5;
+}
+
+
+/* A handful of functions that return their Nth _Decimal128
+ argument. */
+
+_Decimal128 __attribute__((noinline))
+arg0_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2,
+ _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5)
+{
+ return arg0;
+}
+
+_Decimal128 __attribute__((noinline))
+arg1_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2,
+ _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5)
+{
+ return arg1;
+}
+
+_Decimal128 __attribute__((noinline))
+arg2_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2,
+ _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5)
+{
+ return arg2;
+}
+
+_Decimal128 __attribute__((noinline))
+arg3_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2,
+ _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5)
+{
+ return arg3;
+}
+
+_Decimal128 __attribute__((noinline))
+arg4_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2,
+ _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5)
+{
+ return arg4;
+}
+
+_Decimal128 __attribute__((noinline))
+arg5_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2,
+ _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5)
+{
+ return arg5;
+}
+
+
+
+_Decimal32 df0 = 0.0df, df1 = 1.0df, df2 = 2.0df,
+ df3 = 3.0df, df4 = 4.0df, df5 = 5.0df;
+_Decimal32 *pdf0 = &df0, *pdf1 = &df1, *pdf2 = &df2,
+ *pdf3 = &df3, *pdf4 = &df4, *pdf5 = &df5;
+_Decimal64 dd0 = 0.0dd, dd1 = 1.0dd, dd2 = 2.0dd,
+ dd3 = 3.0dd, dd4 = 4.0dd, dd5 = 5.0dd;
+_Decimal64 *pdd0 = &dd0, *pdd1 = &dd1, *pdd2 = &dd2,
+ *pdd3 = &dd3, *pdd4 = &dd4, *pdd5 = &dd5;
+_Decimal128 dl0 = 0.0dl, dl1 = 1.0dl, dl2 = 2.0dl,
+ dl3 = 3.0dl, dl4 = 4.0dl, dl5 = 5.0dl;
+_Decimal128 *pdl0 = &dl0, *pdl1 = &dl1, *pdl2 = &dl2,
+ *pdl3 = &dl3, *pdl4 = &dl4, *pdl5 = &dl5;
+
+int
+main ()
+{
+ /* _Decimal32 variants. */
+ if (arg0_32 (*pdf0, *pdf1, *pdf2, *pdf3, *pdf4, *pdf5) != 0.0df)
+ FAILURE
+ if (arg1_32 (*pdf0, *pdf1, *pdf2, *pdf3, *pdf4, *pdf5) != 1.0df)
+ FAILURE
+ if (arg2_32 (*pdf0, *pdf1, *pdf2, *pdf3, *pdf4, *pdf5) != 2.0df)
+ FAILURE
+ if (arg3_32 (*pdf0, *pdf1, *pdf2, *pdf3, *pdf4, *pdf5) != 3.0df)
+ FAILURE
+ if (arg4_32 (*pdf0, *pdf1, *pdf2, *pdf3, *pdf4, *pdf5) != 4.0df)
+ FAILURE
+ if (arg5_32 (*pdf0, *pdf1, *pdf2, *pdf3, *pdf4, *pdf5) != 5.0df)
+ FAILURE
+
+ /* _Decimal64 variants. */
+ if (arg0_64 (*pdd0, *pdd1, *pdd2, *pdd3, *pdd4, *pdd5) != 0.0dd)
+ FAILURE
+ if (arg1_64 (*pdd0, *pdd1, *pdd2, *pdd3, *pdd4, *pdd5) != 1.0dd)
+ FAILURE
+ if (arg2_64 (*pdd0, *pdd1, *pdd2, *pdd3, *pdd4, *pdd5) != 2.0dd)
+ FAILURE
+ if (arg3_64 (*pdd0, *pdd1, *pdd2, *pdd3, *pdd4, *pdd5) != 3.0dd)
+ FAILURE
+ if (arg4_64 (*pdd0, *pdd1, *pdd2, *pdd3, *pdd4, *pdd5) != 4.0dd)
+ FAILURE
+ if (arg5_64 (*pdd0, *pdd1, *pdd2, *pdd3, *pdd4, *pdd5) != 5.0dd)
+ FAILURE
+
+ /* _Decimal128 variants. */
+ if (arg0_128 (*pdl0, *pdl1, *pdl2, *pdl3, *pdl4, *pdl5) != 0.0dl)
+ FAILURE
+ if (arg1_128 (*pdl0, *pdl1, *pdl2, *pdl3, *pdl4, *pdl5) != 1.0dl)
+ FAILURE
+ if (arg2_128 (*pdl0, *pdl1, *pdl2, *pdl3, *pdl4, *pdl5) != 2.0dl)
+ FAILURE
+ if (arg3_128 (*pdl0, *pdl1, *pdl2, *pdl3, *pdl4, *pdl5) != 3.0dl)
+ FAILURE
+ if (arg4_128 (*pdl0, *pdl1, *pdl2, *pdl3, *pdl4, *pdl5) != 4.0dl)
+ FAILURE
+ if (arg5_128 (*pdl0, *pdl1, *pdl2, *pdl3, *pdl4, *pdl5) != 5.0dl)
+ FAILURE
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/func-mixed.c b/gcc/testsuite/c-c++-common/dfp/func-mixed.c
new file mode 100644
index 000000000..6f7e2eb41
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/func-mixed.c
@@ -0,0 +1,174 @@
+/* { dg-options "-Wall" } */
+
+/* C99 6.5.2.2 Function calls.
+ Test scalar passing and return values involving decimal floating
+ point types. */
+
+#include "dfp-dbg.h"
+
+/* A handful of functions that return their Nth _Decimal32
+ argument with mixed types in parameter list. */
+
+_Decimal32
+arg0_32 (_Decimal32 arg0, int arg1, unsigned int arg2,
+ float arg3, double arg4, long double arg5)
+{
+ return arg0;
+}
+
+_Decimal32
+arg1_32 (int arg0, _Decimal32 arg1, unsigned int arg2,
+ float arg3, double arg4, long double arg5)
+{
+ return arg1;
+}
+
+_Decimal32
+arg2_32 (int arg0, unsigned int arg1, _Decimal32 arg2,
+ float arg3, double arg4, long double arg5)
+{
+ return arg2;
+}
+
+
+_Decimal32
+arg3_32 (int arg0, unsigned int arg1, float arg2,
+ _Decimal32 arg3, double arg4, long double arg5)
+{
+ return arg3;
+}
+
+_Decimal32
+arg4_32 (int arg0, unsigned int arg1, float arg2,
+ double arg3, _Decimal32 arg4, long double arg5)
+{
+ return arg4;
+}
+
+_Decimal32
+arg5_32 (int arg0, unsigned int arg1, float arg2,
+ double arg3, long double arg4, _Decimal32 arg5)
+{
+ return arg5;
+}
+
+/* A handful of functions that return their Nth _Decimal64
+ argument with mixed types in parameter list. */
+
+_Decimal64
+arg0_64 (_Decimal64 arg0, int arg1, unsigned int arg2,
+ float arg3, double arg4, long double arg5)
+{
+ return arg0;
+}
+
+_Decimal64
+arg1_64 (int arg0, _Decimal64 arg1, unsigned int arg2,
+ float arg3, double arg4, long double arg5)
+{
+ return arg1;
+}
+
+_Decimal64
+arg2_64 (int arg0, unsigned int arg1, _Decimal64 arg2,
+ float arg3, double arg4, long double arg5)
+{
+ return arg2;
+}
+
+_Decimal64
+arg3_64 (int arg0, unsigned int arg1, float arg2,
+ _Decimal64 arg3, double arg4, long double arg5)
+{
+ return arg3;
+}
+
+_Decimal64
+arg4_64 (int arg0, unsigned int arg1, float arg2,
+ float arg3, _Decimal64 arg4, long double arg5)
+{
+ return arg4;
+}
+
+_Decimal64
+arg5_64 (int arg0, unsigned int arg1, float arg2,
+ double arg3, long double arg4, _Decimal64 arg5)
+{
+ return arg5;
+}
+
+/* A handful of functions that return their Nth _Decimal128
+ argument with mixed types in parameter list. */
+
+_Decimal128
+arg0_128 (_Decimal128 arg0, int arg1, unsigned int arg2,
+ float arg3, double arg4, long double arg5)
+{
+ return arg0;
+}
+_Decimal128
+arg1_128 (int arg0, _Decimal128 arg1, unsigned int arg2,
+ float arg3, double arg4, long double arg5)
+{
+ return arg1;
+}
+
+_Decimal128
+arg2_128 (int arg0, unsigned int arg1, _Decimal128 arg2,
+ float arg3, double arg4, long double arg5)
+{
+ return arg2;
+}
+
+_Decimal128
+arg3_128 (int arg0, unsigned int arg1, float arg2,
+ _Decimal128 arg3, double arg4, long double arg5)
+{
+ return arg3;
+}
+
+_Decimal128
+arg4_128 (int arg0, unsigned int arg1, float arg2,
+ float arg3, _Decimal32 arg4, long double arg5)
+{
+ return arg4;
+}
+
+_Decimal128
+arg5_128 (int arg0, unsigned int arg1, float arg2,
+ double arg3, long double arg4, _Decimal128 arg5)
+{
+ return arg5;
+}
+
+
+
+int
+main ()
+{
+ /* _Decimal32 variants. */
+ if (arg0_32 (0.0df, -1, 2, 3.0f, 4.0, 5.0l) != 0.0df) FAILURE
+ if (arg1_32 (0, 1.0df, 2, 3.0f, 4.0, 5.0l) != 1.0df) FAILURE
+ if (arg2_32 (0, -1, 2.0df, 3.0f, 4.0, 5.0l) != 2.0df) FAILURE
+ if (arg3_32 (0, -1, 2.0f, 3.0df, 4.0, 5.0l) != 3.0df) FAILURE
+ if (arg4_32 (0, -1, 2.0f, 3.0, 4.0df, 5.0l) != 4.0df) FAILURE
+ if (arg5_32 (0, -1, 2.0f, 3.0, 4.0l, 5.0df) != 5.0df) FAILURE
+
+ /* _Decimal64 variants. */
+ if (arg0_64 (0.0dd, -1, 2, 3.0f, 4.0, 5.0l) != 0.0dd) FAILURE
+ if (arg1_64 (0, 1.0dd, 2, 3.0f, 4.0, 5.0l) != 1.0dd) FAILURE
+ if (arg2_64 (0, -1, 2.0dd, 3.0f, 4.0, 5.0l) != 2.0dd) FAILURE
+ if (arg3_64 (0, -1, 2.0f, 3.0dd, 4.0, 5.0l) != 3.0dd) FAILURE
+ if (arg4_64 (0, -1, 2.0f, 3.0, 4.0dd, 5.0l) != 4.0dd) FAILURE
+ if (arg5_64 (0, -1, 2.0f, 3.0, 4.0l, 5.0dd) != 5.0dd) FAILURE
+
+ /* _Decimal128 variants. */
+ if (arg0_128 (0.0dl, -1, 2, 3.0f, 4.0, 5.0l) != 0.0dl) FAILURE
+ if (arg1_128 (0, 1.0dl, 2, 3.0f, 4.0, 5.0l) != 1.0dl) FAILURE
+ if (arg2_128 (0, -1, 2.0dl, 3.0f, 4.0, 5.0l) != 2.0dl) FAILURE
+ if (arg3_128 (0, -1, 2.0f, 3.0dl, 4.0, 5.0l) != 3.0dl) FAILURE
+ if (arg4_128 (0, -1, 2.0f, 3.0, 4.0dl, 5.0l) != 4.0dl) FAILURE
+ if (arg5_128 (0, -1, 2.0f, 3.0, 4.0l, 5.0dl) != 5.0dl) FAILURE
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/func-pointer.c b/gcc/testsuite/c-c++-common/dfp/func-pointer.c
new file mode 100644
index 000000000..cfdf2356c
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/func-pointer.c
@@ -0,0 +1,205 @@
+/* C99 6.5.2.2 Function calls.
+ Test pointer argument passing and return values involving decimal floating
+ point types. */
+
+#include "dfp-dbg.h"
+
+/* A handful of functions that return their Nth pointer to Decimal32
+ argument. */
+
+_Decimal32 *
+arg0_32 (_Decimal32 *arg0, _Decimal32 *arg1, _Decimal32 *arg2,
+ _Decimal32 *arg3, _Decimal32 *arg4, _Decimal32 *arg5)
+{
+ return arg0;
+}
+
+_Decimal32 *
+arg1_32 (_Decimal32 *arg0, _Decimal32 *arg1, _Decimal32 *arg2,
+ _Decimal32 *arg3, _Decimal32 *arg4, _Decimal32 *arg5)
+{
+ return arg1;
+}
+
+_Decimal32 *
+arg2_32 (_Decimal32 *arg0, _Decimal32 *arg1, _Decimal32 *arg2,
+ _Decimal32 *arg3, _Decimal32 *arg4, _Decimal32 *arg5)
+{
+ return arg2;
+}
+
+_Decimal32 *
+arg3_32 (_Decimal32 *arg0, _Decimal32 *arg1, _Decimal32 *arg2,
+ _Decimal32 *arg3, _Decimal32 *arg4, _Decimal32 *arg5)
+{
+ return arg3;
+}
+
+_Decimal32 *
+arg4_32 (_Decimal32 *arg0, _Decimal32 *arg1, _Decimal32 *arg2,
+ _Decimal32 *arg3, _Decimal32 *arg4, _Decimal32 *arg5)
+{
+ return arg4;
+}
+
+_Decimal32 *
+arg5_32 (_Decimal32 *arg0, _Decimal32 *arg1, _Decimal32 *arg2,
+ _Decimal32 *arg3, _Decimal32 *arg4, _Decimal32 *arg5)
+{
+ return arg5;
+}
+
+
+/* A handful of functions that return their Nth pointer to _Decimal64
+ argument. */
+
+_Decimal64 *
+arg0_64 (_Decimal64 *arg0, _Decimal64 *arg1, _Decimal64 *arg2,
+ _Decimal64 *arg3, _Decimal64 *arg4, _Decimal64 *arg5)
+{
+ return arg0;
+}
+
+_Decimal64 *
+arg1_64 (_Decimal64 *arg0, _Decimal64 *arg1, _Decimal64 *arg2,
+ _Decimal64 *arg3, _Decimal64 *arg4, _Decimal64 *arg5)
+{
+ return arg1;
+}
+
+_Decimal64 *
+arg2_64 (_Decimal64 *arg0, _Decimal64 *arg1, _Decimal64 *arg2,
+ _Decimal64 *arg3, _Decimal64 *arg4, _Decimal64 *arg5)
+{
+ return arg2;
+}
+
+_Decimal64 *
+arg3_64 (_Decimal64 *arg0, _Decimal64 *arg1, _Decimal64 *arg2,
+ _Decimal64 *arg3, _Decimal64 *arg4, _Decimal64 *arg5)
+{
+ return arg3;
+}
+
+_Decimal64 *
+arg4_64 (_Decimal64 *arg0, _Decimal64 *arg1, _Decimal64 *arg2,
+ _Decimal64 *arg3, _Decimal64 *arg4, _Decimal64 *arg5)
+{
+ return arg4;
+}
+
+_Decimal64 *
+arg5_64 (_Decimal64 *arg0, _Decimal64 *arg1, _Decimal64 *arg2,
+ _Decimal64 *arg3, _Decimal64 *arg4, _Decimal64 *arg5)
+{
+ return arg5;
+}
+
+
+/* A handful of functions that return their Nth _Decimal128
+ argument. */
+
+_Decimal128 *
+arg0_128 (_Decimal128 *arg0, _Decimal128 *arg1, _Decimal128 *arg2,
+ _Decimal128 *arg3, _Decimal128 *arg4, _Decimal128 *arg5)
+{
+ return arg0;
+}
+
+_Decimal128 *
+arg1_128 (_Decimal128 *arg0, _Decimal128 *arg1, _Decimal128 *arg2,
+ _Decimal128 *arg3, _Decimal128 *arg4, _Decimal128 *arg5)
+{
+ return arg1;
+}
+
+_Decimal128 *
+arg2_128 (_Decimal128 *arg0, _Decimal128 *arg1, _Decimal128 *arg2,
+ _Decimal128 *arg3, _Decimal128 *arg4, _Decimal128 *arg5)
+{
+ return arg2;
+}
+
+_Decimal128 *
+arg3_128 (_Decimal128 *arg0, _Decimal128 *arg1, _Decimal128 *arg2,
+ _Decimal128 *arg3, _Decimal128 *arg4, _Decimal128 *arg5)
+{
+ return arg3;
+}
+
+_Decimal128 *
+arg4_128 (_Decimal128 *arg0, _Decimal128 *arg1, _Decimal128 *arg2,
+ _Decimal128 *arg3, _Decimal128 *arg4, _Decimal128 *arg5)
+{
+ return arg4;
+}
+
+_Decimal128 *
+arg5_128 (_Decimal128 *arg0, _Decimal128 *arg1, _Decimal128 *arg2,
+ _Decimal128 *arg3, _Decimal128 *arg4, _Decimal128 *arg5)
+{
+ return arg5;
+}
+
+
+
+_Decimal32 df0 = 0.0df, df1 = 1.0df, df2 = 2.0df,
+ df3 = 3.0df, df4 = 4.0df, df5 = 5.0df;
+_Decimal32 *pdf0 = &df0, *pdf1 = &df1, *pdf2 = &df2,
+ *pdf3 = &df3, *pdf4 = &df4, *pdf5 = &df5;
+_Decimal64 dd0 = 0.0dd, dd1 = 1.0dd, dd2 = 2.0dd,
+ dd3 = 3.0dd, dd4 = 4.0dd, dd5 = 5.0dd;
+_Decimal64 *pdd0 = &dd0, *pdd1 = &dd1, *pdd2 = &dd2,
+ *pdd3 = &dd3, *pdd4 = &dd4, *pdd5 = &dd5;
+_Decimal128 dl0 = 0.0dl, dl1 = 1.0dl, dl2 = 2.0dl,
+ dl3 = 3.0dl, dl4 = 4.0dl, dl5 = 5.0dl;
+_Decimal128 *pdl0 = &dl0, *pdl1 = &dl1, *pdl2 = &dl2,
+ *pdl3 = &dl3, *pdl4 = &dl4, *pdl5 = &dl5;
+
+int
+main ()
+{
+ /* _Decimal32 variants. */
+ if (*arg0_32 (pdf0, pdf1, pdf2, pdf3, pdf4, pdf5) != 0.0df)
+ FAILURE
+ if (*arg1_32 (pdf0, pdf1, pdf2, pdf3, pdf4, pdf5) != 1.0df)
+ FAILURE
+ if (*arg2_32 (pdf0, pdf1, pdf2, pdf3, pdf4, pdf5) != 2.0df)
+ FAILURE
+ if (*arg3_32 (pdf0, pdf1, pdf2, pdf3, pdf4, pdf5) != 3.0df)
+ FAILURE
+ if (*arg4_32 (pdf0, pdf1, pdf2, pdf3, pdf4, pdf5) != 4.0df)
+ FAILURE
+ if (*arg5_32 (pdf0, pdf1, pdf2, pdf3, pdf4, pdf5) != 5.0df)
+ FAILURE
+
+ /* _Decimal64 variants. */
+ if (*arg0_64 (pdd0, pdd1, pdd2, pdd3, pdd4, pdd5) != 0.0dd)
+ FAILURE
+ if (*arg1_64 (pdd0, pdd1, pdd2, pdd3, pdd4, pdd5) != 1.0dd)
+ FAILURE
+ if (*arg2_64 (pdd0, pdd1, pdd2, pdd3, pdd4, pdd5) != 2.0dd)
+ FAILURE
+ if (*arg3_64 (pdd0, pdd1, pdd2, pdd3, pdd4, pdd5) != 3.0dd)
+ FAILURE
+ if (*arg4_64 (pdd0, pdd1, pdd2, pdd3, pdd4, pdd5) != 4.0dd)
+ FAILURE
+ if (*arg5_64 (pdd0, pdd1, pdd2, pdd3, pdd4, pdd5) != 5.0dd)
+ FAILURE
+
+ /* _Decimal128 variants. */
+ if (*arg0_128 (pdl0, pdl1, pdl2, pdl3, pdl4, pdl5) != 0.0dl)
+ FAILURE
+ if (*arg1_128 (pdl0, pdl1, pdl2, pdl3, pdl4, pdl5) != 1.0dl)
+ FAILURE
+ if (*arg2_128 (pdl0, pdl1, pdl2, pdl3, pdl4, pdl5) != 2.0dl)
+ FAILURE
+ if (*arg3_128 (pdl0, pdl1, pdl2, pdl3, pdl4, pdl5) != 3.0dl)
+ FAILURE
+ if (*arg4_128 (pdl0, pdl1, pdl2, pdl3, pdl4, pdl5) != 4.0dl)
+ FAILURE
+ if (*arg5_128 (pdl0, pdl1, pdl2, pdl3, pdl4, pdl5) != 5.0dl)
+ FAILURE
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/func-scalar.c b/gcc/testsuite/c-c++-common/dfp/func-scalar.c
new file mode 100644
index 000000000..370c21b20
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/func-scalar.c
@@ -0,0 +1,192 @@
+/* C99 6.5.2.2 Function calls.
+ Test scalar passing and return values involving decimal floating
+ point types. */
+
+#include "dfp-dbg.h"
+
+/* A handful of functions that return their Nth _Decimal32
+ argument. */
+
+_Decimal32
+arg0_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2,
+ _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5)
+{
+ return arg0;
+}
+
+_Decimal32
+arg1_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2,
+ _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5)
+{
+ return arg1;
+}
+
+_Decimal32
+arg2_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2,
+ _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5)
+{
+ return arg2;
+}
+
+_Decimal32
+arg3_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2,
+ _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5)
+{
+ return arg3;
+}
+
+_Decimal32
+arg4_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2,
+ _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5)
+{
+ return arg4;
+}
+
+_Decimal32
+arg5_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2,
+ _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5)
+{
+ return arg5;
+}
+
+
+/* A handful of functions that return their Nth _Decimal64
+ argument. */
+
+_Decimal64
+arg0_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2,
+ _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5)
+{
+ return arg0;
+}
+
+_Decimal64
+arg1_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2,
+ _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5)
+{
+ return arg1;
+}
+
+_Decimal64
+arg2_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2,
+ _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5)
+{
+ return arg2;
+}
+
+_Decimal64
+arg3_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2,
+ _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5)
+{
+ return arg3;
+}
+
+_Decimal64
+arg4_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2,
+ _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5)
+{
+ return arg4;
+}
+
+_Decimal64
+arg5_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2,
+ _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5)
+{
+ return arg5;
+}
+
+
+/* A handful of functions that return their Nth _Decimal128
+ argument. */
+
+_Decimal128
+arg0_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2,
+ _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5)
+{
+ return arg0;
+}
+
+_Decimal128
+arg1_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2,
+ _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5)
+{
+ return arg1;
+}
+
+_Decimal128
+arg2_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2,
+ _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5)
+{
+ return arg2;
+}
+
+_Decimal128
+arg3_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2,
+ _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5)
+{
+ return arg3;
+}
+
+_Decimal128
+arg4_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2,
+ _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5)
+{
+ return arg4;
+}
+
+_Decimal128
+arg5_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2,
+ _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5)
+{
+ return arg5;
+}
+
+
+
+int
+main ()
+{
+ /* _Decimal32 variants. */
+ if (arg0_32 (0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 0.0df)
+ FAILURE
+ if (arg1_32 (0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 1.0df)
+ FAILURE
+ if (arg2_32 (0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 2.0df)
+ FAILURE
+ if (arg3_32 (0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 3.0df)
+ FAILURE
+ if (arg4_32 (0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 4.0df)
+ FAILURE
+ if (arg5_32 (0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 5.0df)
+ FAILURE
+
+ /* _Decimal64 variants. */
+ if (arg0_64 (0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 0.0dd)
+ FAILURE
+ if (arg1_64 (0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 1.0dd)
+ FAILURE
+ if (arg2_64 (0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 2.0dd)
+ FAILURE
+ if (arg3_64 (0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 3.0dd)
+ FAILURE
+ if (arg4_64 (0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 4.0dd)
+ FAILURE
+ if (arg5_64 (0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 5.0dd)
+ FAILURE
+
+ /* _Decimal128 variants. */
+ if (arg0_128 (0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 0.0dl)
+ FAILURE
+ if (arg1_128 (0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 1.0dl)
+ FAILURE
+ if (arg2_128 (0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 2.0dl)
+ FAILURE
+ if (arg3_128 (0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 3.0dl)
+ FAILURE
+ if (arg4_128 (0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 4.0dl)
+ FAILURE
+ if (arg5_128 (0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 5.0dl)
+ FAILURE
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/func-struct.c b/gcc/testsuite/c-c++-common/dfp/func-struct.c
new file mode 100644
index 000000000..ad0224d6c
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/func-struct.c
@@ -0,0 +1,93 @@
+/* C99 6.5.2.2 Function calls.
+ Test structure passing and return values involving decimal floating
+ point types. */
+
+#include "dfp-dbg.h"
+
+struct example
+{
+ _Decimal128 d128;
+ char dummy1;
+ _Decimal64 d64;
+ char dummy2;
+ _Decimal32 d32;
+} nums = { 1.0dl, 'a', 2.0dd, 'b', 3.0df };
+
+_Decimal32
+d32_field (struct example s)
+{
+ return s.d32;
+}
+
+_Decimal64
+d64_field (struct example s)
+{
+ return s.d64;
+}
+
+_Decimal128
+d128_field (struct example s)
+{
+ return s.d128;
+}
+
+char
+dummy1_field (struct example s)
+{
+ return s.dummy1;
+}
+
+char
+dummy2_field (struct example s)
+{
+ return s.dummy2;
+}
+
+_Decimal32
+ptr_d32_field (struct example *s)
+{
+ return s->d32;
+}
+
+_Decimal64
+ptr_d64_field (struct example *s)
+{
+ return s->d64;
+}
+
+_Decimal128
+ptr_d128_field (struct example *s)
+{
+ return s->d128;
+}
+
+char
+ptr_dummy1_field (struct example *s)
+{
+ return s->dummy1;
+}
+
+char
+ptr_dummy2_field (struct example *s)
+{
+ return s->dummy2;
+}
+
+
+int
+main ()
+{
+ if (d32_field (nums) != 3.0df) FAILURE
+ if (d64_field (nums) != 2.0dd) FAILURE
+ if (d128_field (nums) != 1.0dl) FAILURE
+ if (dummy1_field (nums) != 'a') FAILURE
+ if (dummy2_field (nums) != 'b') FAILURE
+
+ if (ptr_d32_field (&nums) != 3.0df) FAILURE
+ if (ptr_d64_field (&nums) != 2.0dd) FAILURE
+ if (ptr_d128_field (&nums) != 1.0dl) FAILURE
+ if (ptr_dummy1_field (&nums) != 'a') FAILURE
+ if (ptr_dummy2_field (&nums) != 'b') FAILURE
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/func-vararg-alternate-d128-2.c b/gcc/testsuite/c-c++-common/dfp/func-vararg-alternate-d128-2.c
new file mode 100644
index 000000000..2960c357a
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/func-vararg-alternate-d128-2.c
@@ -0,0 +1,22 @@
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+/* { dg-options "-mpreferred-stack-boundary=2" } */
+
+/* Simple test of vararg passing for problematic types with and without
+ double values passed between them. */
+
+#define DTYPE _Decimal128
+#define ONE 1.0dl
+#define THREE 3.0dl
+#define SEVEN 7.0dl
+#define ELEVEN 11.0dl
+#define INTS 4
+
+#include "func-vararg-alternate.h"
+
+int
+main ()
+{
+ doit ();
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/func-vararg-alternate-d128.c b/gcc/testsuite/c-c++-common/dfp/func-vararg-alternate-d128.c
new file mode 100644
index 000000000..8d452eadc
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/func-vararg-alternate-d128.c
@@ -0,0 +1,19 @@
+/* Simple test of vararg passing for problematic types with and without
+ double values passed between them. */
+
+#define DTYPE _Decimal128
+#define ONE 1.0dl
+#define THREE 3.0dl
+#define SEVEN 7.0dl
+#define ELEVEN 11.0dl
+#define INTS 4
+
+#include "func-vararg-alternate.h"
+
+int
+main ()
+{
+ doit ();
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/func-vararg-alternate-d32.c b/gcc/testsuite/c-c++-common/dfp/func-vararg-alternate-d32.c
new file mode 100644
index 000000000..651b7e8c5
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/func-vararg-alternate-d32.c
@@ -0,0 +1,19 @@
+/* Simple test of vararg passing for problematic types with and without
+ double values passed between them. */
+
+#define DTYPE _Decimal32
+#define ONE 1.0df
+#define THREE 3.0df
+#define SEVEN 7.0df
+#define ELEVEN 11.0df
+#define INTS 1
+
+#include "func-vararg-alternate.h"
+
+int
+main ()
+{
+ doit ();
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/func-vararg-alternate-d64.c b/gcc/testsuite/c-c++-common/dfp/func-vararg-alternate-d64.c
new file mode 100644
index 000000000..86b475d2a
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/func-vararg-alternate-d64.c
@@ -0,0 +1,19 @@
+/* Simple test of vararg passing for problematic types with and without
+ double values passed between them. */
+
+#define DTYPE _Decimal64
+#define ONE 1.0dd
+#define THREE 3.0dd
+#define SEVEN 7.0dd
+#define ELEVEN 11.0dd
+#define INTS 2
+
+#include "func-vararg-alternate.h"
+
+int
+main ()
+{
+ doit ();
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/func-vararg-alternate.h b/gcc/testsuite/c-c++-common/dfp/func-vararg-alternate.h
new file mode 100644
index 000000000..5ba0ab0dc
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/func-vararg-alternate.h
@@ -0,0 +1,143 @@
+/* Simple test of vararg passing for problematic types with and without
+ double values passed between them. */
+
+#include "dfp-dbg.h"
+#include <stdarg.h>
+
+DTYPE a[10];
+double b[10];
+
+union U {
+ DTYPE d;
+ unsigned int i[INTS];
+};
+
+void
+compare (double r, double s, unsigned int *p, unsigned int *q, int n, int line)
+{
+ int i;
+
+ for (i = 0; i < n; i++)
+ if (r != s || p[i] != q[i])
+#ifdef DBG
+ {
+ int j;
+
+ failures++;
+ printf ("line %-3d", line);
+ for (j = 0; j < n; j++)
+ printf (" %08x", p[j]);
+ printf (" %10.2g\n ", r);
+ for (j = 0; j < n; j++)
+ printf (" %08x", q[j]);
+ printf (" %10.2g\n\n", s);
+
+ return;
+ }
+#else
+ __builtin_abort ();
+#endif
+}
+
+void
+bar0 (int n, ...)
+{
+ union U u;
+ int j;
+ va_list ap;
+
+ va_start (ap, n);
+ for (j = 0; j < n; j++)
+ a[j] = va_arg (ap, DTYPE);
+ va_end (ap);
+}
+
+void
+bar1 (int n, ...)
+{
+ union U u;
+ int j;
+ va_list ap;
+
+ va_start (ap, n);
+ for (j = 0; j < n; j++)
+ {
+ a[j] = va_arg (ap, DTYPE);
+ b[j] = va_arg (ap, double);
+ }
+ va_end (ap);
+}
+
+void
+bar2 (int n, ...)
+{
+ union U u;
+ int j;
+ va_list ap;
+
+ va_start (ap, n);
+ for (j = 0; j < n; j++)
+ {
+ b[j] = va_arg (ap, double);
+ a[j] = va_arg (ap, DTYPE);
+ }
+ va_end (ap);
+}
+
+void
+doit ()
+{
+ DTYPE x, y, z;
+ union U u1, u2;
+
+ /* Sanity check that test setup is right, especially for long double
+ which can be changed by command line option. */
+ if (INTS * 4 != sizeof (DTYPE))
+ {
+#ifdef DBG
+ printf ("test error: INTS = %d, sizeof (DTYPE) = %d\n",
+ INTS, sizeof (DTYPE));
+#endif
+ __builtin_abort ();
+ }
+
+ x = ONE / THREE;
+ y = ONE / SEVEN;
+ z = ONE / ELEVEN;
+
+ bar0 (1, x);
+ u1.d = x; u2.d = a[0]; compare (0.0, 0.0, u1.i, u2.i, INTS, __LINE__);
+
+ bar0 (2, x, y);
+ u1.d = x; u2.d = a[0]; compare (0.0, 0.0, u1.i, u2.i, INTS, __LINE__);
+ u1.d = y; u2.d = a[1]; compare (0.0, 0.0, u1.i, u2.i, INTS, __LINE__);
+
+ bar0 (3, x, y, z);
+ u1.d = x; u2.d = a[0]; compare (0.0, 0.0, u1.i, u2.i, INTS, __LINE__);
+ u1.d = y; u2.d = a[1]; compare (0.0, 0.0, u1.i, u2.i, INTS, __LINE__);
+ u1.d = z; u2.d = a[2]; compare (0.0, 0.0, u1.i, u2.i, INTS, __LINE__);
+
+ bar1 (1, x, 1.5);
+ u1.d = x; u2.d = a[0]; compare (1.5, b[0], u1.i, u2.i, INTS, __LINE__);
+
+ bar1 (2, x, 1.5, y, 2.5);
+ u1.d = x; u2.d = a[0]; compare (1.5, b[0], u1.i, u2.i, INTS, __LINE__);
+ u1.d = y; u2.d = a[1]; compare (2.5, b[1], u1.i, u2.i, INTS, __LINE__);
+
+ bar1 (3, x, 1.5, y, 2.5, z, 3.5);
+ u1.d = x; u2.d = a[0]; compare (1.5, b[0], u1.i, u2.i, INTS, __LINE__);
+ u1.d = y; u2.d = a[1]; compare (2.5, b[1], u1.i, u2.i, INTS, __LINE__);
+ u1.d = z; u2.d = a[2]; compare (3.5, b[2], u1.i, u2.i, INTS, __LINE__);
+
+ bar2 (1, 1.5, x);
+ u1.d = x; u2.d = a[0]; compare (1.5, b[0], u1.i, u2.i, INTS, __LINE__);
+
+ bar2 (2, 1.5, x, 2.5, y);
+ u1.d = x; u2.d = a[0]; compare (1.5, b[0], u1.i, u2.i, INTS, __LINE__);
+ u1.d = y; u2.d = a[1]; compare (2.5, b[1], u1.i, u2.i, INTS, __LINE__);
+
+ bar2 (3, 1.5, x, 2.5, y, 3.5, z);
+ u1.d = x; u2.d = a[0]; compare (1.5, b[0], u1.i, u2.i, INTS, __LINE__);
+ u1.d = y; u2.d = a[1]; compare (2.5, b[1], u1.i, u2.i, INTS, __LINE__);
+ u1.d = z; u2.d = a[2]; compare (3.5, b[2], u1.i, u2.i, INTS, __LINE__);
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/func-vararg-dfp.c b/gcc/testsuite/c-c++-common/dfp/func-vararg-dfp.c
new file mode 100644
index 000000000..5add1f7fd
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/func-vararg-dfp.c
@@ -0,0 +1,95 @@
+/* C99 6.5.2.2 Function calls.
+ Test passing varargs of the decimal float types. */
+
+#include <stdarg.h>
+#include "dfp-dbg.h"
+
+static _Decimal32
+vararg32 (unsigned arg, ...)
+{
+ int i;
+ va_list ap;
+ _Decimal32 result;
+
+ va_start (ap, arg);
+ for (i = 0; i <= arg; i++)
+ result = va_arg (ap, _Decimal32);
+ va_end (ap);
+ return result;
+}
+
+static _Decimal64
+vararg64 (unsigned arg, ...)
+{
+ int i;
+ va_list ap;
+ _Decimal64 result;
+
+ va_start (ap, arg);
+ for (i = 0; i <= arg; i++)
+ result = va_arg (ap, _Decimal64);
+ va_end (ap);
+ return result;
+}
+
+static _Decimal128
+vararg128 (unsigned arg, ...)
+{
+ int i;
+ va_list ap;
+ _Decimal128 result;
+
+ va_start (ap, arg);
+ for (i = 0; i <= arg; i++)
+ result = va_arg (ap, _Decimal128);
+ va_end (ap);
+ return result;
+}
+
+
+int main()
+{
+ /* _Decimal32 variants. */
+ if (vararg32 (0, 0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 0.0df)
+ FAILURE
+ if (vararg32 (1, 0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 1.0df)
+ FAILURE
+ if (vararg32 (2, 0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 2.0df)
+ FAILURE
+ if (vararg32 (3, 0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 3.0df)
+ FAILURE
+ if (vararg32 (4, 0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 4.0df)
+ FAILURE
+ if (vararg32 (5, 0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 5.0df)
+ FAILURE
+
+ /* _Decimal64 variants. */
+ if (vararg64 (0, 0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 0.0dd)
+ FAILURE
+ if (vararg64 (1, 0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 1.0dd)
+ FAILURE
+ if (vararg64 (2, 0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 2.0dd)
+ FAILURE
+ if (vararg64 (3, 0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 3.0dd)
+ FAILURE
+ if (vararg64 (4, 0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 4.0dd)
+ FAILURE
+ if (vararg64 (5, 0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 5.0dd)
+ FAILURE
+
+ /* _Decimal128 variants. */
+ if (vararg128 (0, 0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 0.0dl)
+ FAILURE
+ if (vararg128 (1, 0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 1.0dl)
+ FAILURE
+ if (vararg128 (2, 0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 2.0dl)
+ FAILURE
+ if (vararg128 (3, 0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 3.0dl)
+ FAILURE
+ if (vararg128 (4, 0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 4.0dl)
+ FAILURE
+ if (vararg128 (5, 0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 5.0dl)
+ FAILURE
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/func-vararg-mixed-2.c b/gcc/testsuite/c-c++-common/dfp/func-vararg-mixed-2.c
new file mode 100644
index 000000000..893cdae27
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/func-vararg-mixed-2.c
@@ -0,0 +1,105 @@
+/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+/* { dg-options "-mpreferred-stack-boundary=2" } */
+
+/* C99 6.5.2.2 Function calls.
+ Test passing varargs of the combination of decimal float types and
+ other types. */
+
+#include <stdarg.h>
+#include "dfp-dbg.h"
+
+/* Supposing the list of varying number of arguments is:
+ unsigned int, _Decimal128, double, _Decimal32, _Decimal64. */
+
+static _Decimal32
+vararg_d32 (unsigned arg, ...)
+{
+ va_list ap;
+ _Decimal32 result;
+
+ va_start (ap, arg);
+
+ va_arg (ap, unsigned int);
+ va_arg (ap, _Decimal128);
+ va_arg (ap, double);
+ result = va_arg (ap, _Decimal32);
+
+ va_end (ap);
+ return result;
+}
+
+static _Decimal32
+vararg_d64 (unsigned arg, ...)
+{
+ va_list ap;
+ _Decimal64 result;
+
+ va_start (ap, arg);
+
+ va_arg (ap, unsigned int);
+ va_arg (ap, _Decimal128);
+ va_arg (ap, double);
+ va_arg (ap, _Decimal32);
+ result = va_arg (ap, _Decimal64);
+
+ va_end (ap);
+ return result;
+}
+
+static _Decimal128
+vararg_d128 (unsigned arg, ...)
+{
+ va_list ap;
+ _Decimal128 result;
+
+ va_start (ap, arg);
+
+ va_arg (ap, unsigned int);
+ result = va_arg (ap, _Decimal128);
+
+ va_end (ap);
+ return result;
+}
+
+static unsigned int
+vararg_int (unsigned arg, ...)
+{
+ va_list ap;
+ unsigned int result;
+
+ va_start (ap, arg);
+
+ result = va_arg (ap, unsigned int);
+
+ va_end (ap);
+ return result;
+}
+
+static double
+vararg_double (unsigned arg, ...)
+{
+ va_list ap;
+ float result;
+
+ va_start (ap, arg);
+
+ va_arg (ap, unsigned int);
+ va_arg (ap, _Decimal128);
+ result = va_arg (ap, double);
+
+ va_end (ap);
+ return result;
+}
+
+
+int
+main ()
+{
+ if (vararg_d32 (3, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 3.0df) FAILURE
+ if (vararg_d64 (4, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 4.0dd) FAILURE
+ if (vararg_d128 (1, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 1.0dl) FAILURE
+ if (vararg_int (0, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 0) FAILURE
+ if (vararg_double (2, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 2.0) FAILURE
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/func-vararg-mixed.c b/gcc/testsuite/c-c++-common/dfp/func-vararg-mixed.c
new file mode 100644
index 000000000..1669eaf95
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/func-vararg-mixed.c
@@ -0,0 +1,102 @@
+/* C99 6.5.2.2 Function calls.
+ Test passing varargs of the combination of decimal float types and
+ other types. */
+
+#include <stdarg.h>
+#include "dfp-dbg.h"
+
+/* Supposing the list of varying number of arguments is:
+ unsigned int, _Decimal128, double, _Decimal32, _Decimal64. */
+
+static _Decimal32
+vararg_d32 (unsigned arg, ...)
+{
+ va_list ap;
+ _Decimal32 result;
+
+ va_start (ap, arg);
+
+ va_arg (ap, unsigned int);
+ va_arg (ap, _Decimal128);
+ va_arg (ap, double);
+ result = va_arg (ap, _Decimal32);
+
+ va_end (ap);
+ return result;
+}
+
+static _Decimal32
+vararg_d64 (unsigned arg, ...)
+{
+ va_list ap;
+ _Decimal64 result;
+
+ va_start (ap, arg);
+
+ va_arg (ap, unsigned int);
+ va_arg (ap, _Decimal128);
+ va_arg (ap, double);
+ va_arg (ap, _Decimal32);
+ result = va_arg (ap, _Decimal64);
+
+ va_end (ap);
+ return result;
+}
+
+static _Decimal128
+vararg_d128 (unsigned arg, ...)
+{
+ va_list ap;
+ _Decimal128 result;
+
+ va_start (ap, arg);
+
+ va_arg (ap, unsigned int);
+ result = va_arg (ap, _Decimal128);
+
+ va_end (ap);
+ return result;
+}
+
+static unsigned int
+vararg_int (unsigned arg, ...)
+{
+ va_list ap;
+ unsigned int result;
+
+ va_start (ap, arg);
+
+ result = va_arg (ap, unsigned int);
+
+ va_end (ap);
+ return result;
+}
+
+static double
+vararg_double (unsigned arg, ...)
+{
+ va_list ap;
+ float result;
+
+ va_start (ap, arg);
+
+ va_arg (ap, unsigned int);
+ va_arg (ap, _Decimal128);
+ result = va_arg (ap, double);
+
+ va_end (ap);
+ return result;
+}
+
+
+int
+main ()
+{
+ if (vararg_d32 (3, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 3.0df) FAILURE
+ if (vararg_d64 (4, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 4.0dd) FAILURE
+ if (vararg_d128 (1, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 1.0dl) FAILURE
+ if (vararg_int (0, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 0) FAILURE
+ if (vararg_double (2, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 2.0) FAILURE
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/func-vararg-size0.c b/gcc/testsuite/c-c++-common/dfp/func-vararg-size0.c
new file mode 100644
index 000000000..bc8b20fd4
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/func-vararg-size0.c
@@ -0,0 +1,41 @@
+/* C99 6.5.2.2 Function calls. */
+
+#include <stdarg.h>
+#include "dfp-dbg.h"
+
+struct S1
+{
+ struct
+ {
+ _Decimal64 e;
+ } b[0];
+};
+
+/* Test handling vararg parameters whose size is 0. */
+
+int check_var(int z,...)
+{
+ double d;
+ struct S1 s1;
+ long long result;
+ va_list ap;
+ va_start (ap, z);
+ d = va_arg (ap, double);
+ s1 = va_arg (ap, struct S1);
+ result = va_arg (ap, long long);
+ va_end (ap);
+ return (result == 2LL);
+
+}
+
+int
+main ()
+{
+ struct S1 s1;
+ struct S1 a1[5];
+
+ if (check_var(5, 1.0, s1, 2LL, a1[2], a1[2]) == 0)
+ FAILURE
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/inf-1.c b/gcc/testsuite/c-c++-common/dfp/inf-1.c
new file mode 100644
index 000000000..c4f8cd796
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/inf-1.c
@@ -0,0 +1,61 @@
+/* N1150 4: Characteristics of decimal floating types (not explicit)
+ C99 5.2.4.2.2: Characteristics of floating types.
+ A few simple checks on arithmetic operations. */
+
+#include "dfp-dbg.h"
+
+int main()
+{
+ /* Assumes rounding mode. */
+ if (9999999.E90DF + 1.E90df != __builtin_infd32 ())
+ FAILURE
+
+ if (!__builtin_isinfd32 (9999999.E90DF + 1.E90df))
+ FAILURE
+
+ if (9.999999999999999E384dd + .000000000000001e384dd
+ != __builtin_infd32 ())
+ FAILURE
+
+ if (-9999999.E90DF - 1.E90df != -__builtin_infd32 ())
+ FAILURE
+
+ if (!__builtin_isinfd32 (9.999999999999999E384dd + .000000000000001e384dd))
+ FAILURE
+
+ if (7.999999999999999999999999999999999E6144dl + 3.0E6144dl
+ != __builtin_infd32 ())
+ FAILURE
+
+ if (__builtin_infd32 () * __builtin_infd32 () != __builtin_infd32 ())
+ FAILURE
+
+ if (__builtin_infd32 () * 2 != __builtin_infd32 ())
+ FAILURE
+
+ if (__builtin_infd64 () * -5 != -__builtin_infd32 ())
+ FAILURE
+
+ if (!__builtin_isinfd128 (__builtin_infd32 () / 4))
+ FAILURE
+
+ if (__builtin_infd64 () != __builtin_infd128 ())
+ FAILURE
+
+ if (!__builtin_isinfd64 (__builtin_infd128 ()))
+ FAILURE
+
+ if (__builtin_finited64 (__builtin_infd32 () * 4))
+ FAILURE
+
+ if (!__builtin_finited128 (9.999999E90DL - 1.E90dd))
+ FAILURE
+
+ if (__builtin_finited128 (__builtin_infd32 () *__builtin_infd128 ()))
+ FAILURE
+
+ if (__builtin_finited32 (__builtin_nand32 ("")))
+ FAILURE
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/loop-index.c b/gcc/testsuite/c-c++-common/dfp/loop-index.c
new file mode 100644
index 000000000..a944042a7
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/loop-index.c
@@ -0,0 +1,57 @@
+/* C99 6.8.5.2: The for statement. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "dfp-dbg.h"
+
+void
+f32 (void)
+{
+ _Decimal32 d;
+ int i;
+
+ for (d = 1.1df, i=0; d <= 1.5df; d += 0.1df)
+ i++;
+
+ if (i != 5)
+ FAILURE
+}
+
+void
+f64 (void)
+{
+ _Decimal64 d;
+ int i;
+
+ for (d = 1.1dd, i=0; d <= 1.5dd; d += 0.1dd)
+ i++;
+
+ if (i != 5)
+ FAILURE
+}
+
+void
+f128 (void)
+{
+ _Decimal128 d;
+ int i;
+
+ for (d = 1.1dl, i=0; d <= 1.5dl; d += 0.1dl)
+ i++;
+
+ if (i != 5)
+ FAILURE
+}
+
+int
+main ()
+{
+ int i;
+
+ f32 ();
+ f64 ();
+ f128 ();
+
+ FINISH
+ return (0);
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/modes.c b/gcc/testsuite/c-c++-common/dfp/modes.c
new file mode 100644
index 000000000..09d4a15c2
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/modes.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+
+typedef float decimal32 __attribute__ ((mode (SD)));
+typedef float decimal64 __attribute__ ((mode (DD)));
+typedef float decimal128 __attribute__ ((mode (TD)));
+
+int ssize[sizeof (decimal32) == 4 ? 1 : -1];
+int dsize[sizeof (decimal64) == 8 ? 1 : -1];
+int tsize[sizeof (decimal128) == 16 ? 1 : -1];
+
+int salign = __alignof (decimal32);
+int dalign = __alignof (decimal64);
+int talign = __alignof (decimal128);
+
diff --git a/gcc/testsuite/c-c++-common/dfp/nan-1.c b/gcc/testsuite/c-c++-common/dfp/nan-1.c
new file mode 100644
index 000000000..8961777c7
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/nan-1.c
@@ -0,0 +1,106 @@
+/* N1150 4: Characteristics of decimal floating types (not explicit)
+ C99 5.2.4.2.2: Characteristics of floating types.
+ A few simple checks on arithmetic operations. */
+
+#include "dfp-dbg.h"
+
+int main()
+{
+ /* Some possibly non-obvious tests, but most logical
+ operations on NaN return false, including NaN == NaN. */
+ if (__builtin_nand32("") == __builtin_nand32(""))
+ FAILURE
+
+ if (__builtin_nand64("") == __builtin_nand64(""))
+ FAILURE
+
+ if (__builtin_nand128("") == __builtin_nand128(""))
+ FAILURE
+
+ if (!(__builtin_nand32("") != __builtin_nand32("")))
+ FAILURE
+
+ if (!(__builtin_nand64("") != __builtin_nand64("")))
+ FAILURE
+
+ if (!(__builtin_nand128("") != __builtin_nand128("")))
+ FAILURE
+
+ if (__builtin_nand32("") > __builtin_nand32(""))
+ FAILURE
+
+ if (__builtin_nand64("") >= __builtin_nand64(""))
+ FAILURE
+
+ if (__builtin_nand128("") < __builtin_nand128(""))
+ FAILURE
+
+ if (-__builtin_nand128("") < +__builtin_nand128(""))
+ FAILURE
+
+ /* 0.0/0.0 => NaN, but NaN != NaN. */
+ if (0.0df/0.0dl == __builtin_nand32(""))
+ FAILURE
+
+ /* 0.0 * INF => NaN. */
+ if (!__builtin_isnand32 (0.0df * __builtin_infd32()))
+ FAILURE
+
+ if (!__builtin_isnand64 (0.0dd * __builtin_infd64()))
+ FAILURE
+
+ if (!__builtin_isnand128 (0.0dd * __builtin_infd128()))
+ FAILURE
+
+ /* INF - INF => NaN. */
+ if (!__builtin_isnand32 (__builtin_infd32() - __builtin_infd32()))
+ FAILURE
+
+ if (!__builtin_isnand64 (__builtin_infd64() - __builtin_infd64()))
+ FAILURE
+
+ if (!__builtin_isnand128 (__builtin_infd128() - __builtin_infd128()))
+ FAILURE
+
+ /* INF/INF => NaN. */
+ if (!__builtin_isnand32 (__builtin_infd32()/__builtin_infd32()) )
+ FAILURE
+
+ if (!__builtin_isnand64 (__builtin_infd64()/__builtin_infd64()) )
+ FAILURE
+
+ if (!__builtin_isnand128 (__builtin_infd128()/__builtin_infd128()) )
+ FAILURE
+
+ /* 0.0/0.0 => NaN, but NaN != NaN. */
+ if ((0.0dd/0.0df) == (0.0dd/0.0df))
+ FAILURE
+
+ if (__builtin_nand32("") < __builtin_infd32())
+ FAILURE
+
+ if (__builtin_nand32("") >= __builtin_infd32())
+ FAILURE
+
+ /* Fixme: Add sqrtdf(-x.df) test when sqrt is supported. */
+
+ if (!__builtin_isnand32(__builtin_nand32("")))
+ FAILURE
+
+ if (!__builtin_isnand64(__builtin_nand64("")))
+ FAILURE
+
+ if (!__builtin_isnand128(__builtin_nand128("")))
+ FAILURE
+
+ if (!__builtin_isnand128(8.0df * __builtin_nand128("")))
+ FAILURE
+
+ if (!__builtin_isnand32(8.1dl - __builtin_nand32("")))
+ FAILURE
+
+ if (!__builtin_isnand128(__builtin_nand64("") + __builtin_nand128("")))
+ FAILURE
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/nan-2.c b/gcc/testsuite/c-c++-common/dfp/nan-2.c
new file mode 100644
index 000000000..ec9d18e10
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/nan-2.c
@@ -0,0 +1,53 @@
+/* N1150 4: Characteristics of decimal floating types (not explicit)
+ C99 5.2.4.2.2: Characteristics of floating types.
+ A few simple checks on arithmetic operations. Based on nan-1.c with
+ the consideration of negative zero. */
+
+#include "dfp-dbg.h"
+
+int main()
+{
+ _Decimal32 d32;
+ _Decimal64 d64;
+ _Decimal128 d128;
+
+ /* Verify that division by negative zero produces a negative infinity
+ result. */
+ d32 = 123.45f;
+ if (d32/-0.0df != -__builtin_infd32())
+ FAILURE
+ if (123.45df/-0.0df != -__builtin_infd32())
+ FAILURE
+
+ d64 = 123.45f;
+ if (d64/-0.0dd != -__builtin_infd64())
+ FAILURE
+ if (123.45dd/-0.0dd != -__builtin_infd64())
+ FAILURE
+
+ d128 = 123.45f;
+ if (d128/-0.0dl != -__builtin_infd64())
+ FAILURE
+ if (123.45dl/-0.0dl != -__builtin_infd128())
+ FAILURE
+
+ d32 = 0.0df;
+ if (!__builtin_isnand32(-(d32/-0.0df)))
+ FAILURE
+ if (!__builtin_isnand32(-(0.0df/-0.0df)))
+ FAILURE
+
+ d64 = 0.0dd;
+ if (!__builtin_isnand64(-(d64/-0.0dd)))
+ FAILURE
+ if (!__builtin_isnand64(-(0.0dd/-0.0dd)))
+ FAILURE
+
+ d128 = 0.0dl;
+ if (!__builtin_isnand128(-(d128/-0.0dl)))
+ FAILURE
+ if (!__builtin_isnand128(-(0.0dl/-0.0dl)))
+ FAILURE
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/operator-arith-fold.c b/gcc/testsuite/c-c++-common/dfp/operator-arith-fold.c
new file mode 100644
index 000000000..c4aa4cbb2
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/operator-arith-fold.c
@@ -0,0 +1,45 @@
+/* { dg-options "-O2" } */
+
+/* C99 6.5.5: Multiplicative operators.
+ C99 6.5.6: Additive operators. */
+
+#include "dfp-dbg.h"
+
+extern void link_error (void);
+
+int
+main ()
+{
+ _Decimal32 d32_1, d32_2;
+
+ /* Compare like-typed positive constants. */
+ if (2.99df + 5.1df != 8.09df)
+ link_error ();
+
+ if (5.77df - 2.22dd != 3.55df)
+ link_error ();
+
+ if (2.0dl * 3.7dd * -2 != -14.8df)
+ link_error ();
+
+ if (.18df / -.2df + 1 != 1.e-1dd)
+ link_error ();
+
+ d32_1 = 3.0df;
+ d32_2 = 1.0df;
+
+ if (!__builtin_constant_p (d32_1 + 0.2df))
+ link_error ();
+
+ if (!__builtin_constant_p (1.0df / 3.0df))
+ link_error ();
+
+ if (!__builtin_constant_p (d32_2 / d32_1))
+ link_error ();
+
+ d32_2 = 2.0df;
+ if (!__builtin_constant_p (d32_2 / d32_1))
+ link_error ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/operator-assignment.c b/gcc/testsuite/c-c++-common/dfp/operator-assignment.c
new file mode 100644
index 000000000..faadf1e86
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/operator-assignment.c
@@ -0,0 +1,56 @@
+/* C99 6.5.16 Assignment operators.
+ Verify the compound assignment operator for decimal float types,
+ using it with other decimal float types, integers, and other binary
+ float types cast to decimal float types. */
+
+#include "dfp-dbg.h"
+
+#define OPERATE(OPRD1,OPRT,OPRD2,RLT) \
+ if (( OPRD1 OPRT OPRD2 )!= RLT) \
+ FAILURE
+
+#define DECIMAL_COMPOUND_ASSIGNMENT(TYPE, OPRD) \
+{ \
+ _Decimal##TYPE d = OPRD; \
+ OPERATE(d,+=,1,(OPRD + 1)); \
+ d = OPRD; \
+ OPERATE(d,+=,0,OPRD); \
+ d = OPRD; \
+ OPERATE(d,+=,(-1),(OPRD - 1)); \
+ d = OPRD; \
+ OPERATE(d,+=,d32a,(OPRD + d32a)); \
+ d = OPRD; \
+ OPERATE(d,+=,d64a,(OPRD + d64a)); \
+ d = OPRD; \
+ OPERATE(d,+=,d128a,(OPRD + d128a)); \
+ d = OPRD; \
+ OPERATE(d,+=,(_Decimal##TYPE)1.1,(OPRD + (_Decimal##TYPE)1.1)); \
+ d = OPRD; \
+ OPERATE(d,+=,(_Decimal##TYPE)2.2f,(OPRD + (_Decimal##TYPE)2.2f)); \
+ d = OPRD; \
+ OPERATE(d,-=,1,(OPRD - 1)); \
+ d = OPRD; \
+ OPERATE(d,-=,0,OPRD); \
+ d = OPRD; \
+ OPERATE(d,-=,(-1),(OPRD + 1)); \
+ d = OPRD; \
+ OPERATE(d,-=,d32a,OPRD-d32a); \
+ d = OPRD; \
+ OPERATE(d,-=,d64a,OPRD-d64a); \
+ d = OPRD; \
+ OPERATE(d,-=,d128a,OPRD-d128a); \
+}
+
+int
+main ()
+{
+ _Decimal32 d32 = 1.23456df, d32a = 1.2df;
+ _Decimal64 d64 = 23.456789dd, d64a = 2.8dd;
+ _Decimal128 d128 = 345.67890123456789dl, d128a = 4.7dl;
+
+ DECIMAL_COMPOUND_ASSIGNMENT(32, d32);
+ DECIMAL_COMPOUND_ASSIGNMENT(64, d64);
+ DECIMAL_COMPOUND_ASSIGNMENT(128, d128);
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/operator-comma.c b/gcc/testsuite/c-c++-common/dfp/operator-comma.c
new file mode 100644
index 000000000..be6bf6f8c
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/operator-comma.c
@@ -0,0 +1,47 @@
+/* { dg-options "-O0" } */
+
+/* C99 6.5.17: Comma operator.
+ Test with decimal float operands. */
+
+#include "dfp-dbg.h"
+
+volatile _Decimal32 d32a, d32b, d32c;
+volatile _Decimal64 d64a, d64b, d64c;
+volatile _Decimal128 d128a, d128b, d128c;
+
+void
+init ()
+{
+ d32b = 123.456e94df;
+ d64b = 12.3456789012345e383dd;
+ d128b = 12345.6789012345678901e4000dl;
+
+ d32c = 1.3df;
+ d64c = 1.2dd;
+ d128c = 1.1dl;
+}
+
+int
+main ()
+{
+ d32a = (d32b, d32c);
+ if (d32a != d32c)
+ FAILURE
+ d64a = (d64b, 7.89dd, d64c);
+ if (d64a != d64c)
+ FAILURE
+ d128a = (45678.987654dl, d128c, d128b);
+ if (d128a != d128b)
+ FAILURE
+ d128a = (d32b, d64b, d128b);
+ if (d128a != d128b)
+ FAILURE
+ d32a = (d32b, 12, d64c);
+ if (d32a != d64c)
+ FAILURE;
+ d64a = (d64b, d32b, 12);
+ if (d64a != 12.0dd)
+ FAILURE;
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/operator-cond.c b/gcc/testsuite/c-c++-common/dfp/operator-cond.c
new file mode 100644
index 000000000..140dd9507
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/operator-cond.c
@@ -0,0 +1,57 @@
+/* { dg-options "-O0" } */
+
+/* C99 6.5.15 Conditional operator.
+ Test with decimal float operands. */
+
+#include "dfp-dbg.h"
+
+volatile _Decimal32 d32a, d32b, d32c;
+volatile _Decimal64 d64a, d64b, d64c;
+volatile _Decimal128 d128a, d128b, d128c;
+volatile int i, yes, no;
+
+void
+init ()
+{
+ d32b = 123.456e94df;
+ d64b = 12.3456789012345e383dd;
+ d128b = 12345.6789012345678901e4000dl;
+
+ d32c = 1.3df;
+ d64c = 1.2dd;
+ d128c = 1.1dl;
+
+ i = 2;
+ yes = 1;
+ no = 0;
+}
+
+int
+main ()
+{
+ init ();
+
+ /* Operands and the result are all the same decimal float type. */
+ d32a = yes ? d32b : d32c;
+ if (d32a != d32b)
+ FAILURE
+ d64a = no ? d64b : d64c;
+ if (d64a != d64c)
+ FAILURE
+ d128a = yes ? d128b : d128c;
+ if (d128a != d128b)
+ FAILURE
+
+ /* Operand types are different. */
+ d128a = yes ? d32b : d64b;
+ if (d128a != d32b)
+ FAILURE
+ d128a = yes ? d128b : d64b;
+ if (d128a != d128b)
+ FAILURE
+ d128a = no ? d32b : d128b;
+ if (d128a != d128b)
+ FAILURE
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/operator-logical.c b/gcc/testsuite/c-c++-common/dfp/operator-logical.c
new file mode 100644
index 000000000..c784468c7
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/operator-logical.c
@@ -0,0 +1,63 @@
+/* C99 Logical AND operator.
+ C99 Logical OR operator.
+ Test with decimal float operands. */
+
+#include "dfp-dbg.h"
+
+#define OPERATE(OPRD1,OPRT,OPRD2,RLT) \
+do \
+{ \
+ if (( (OPRD1) OPRT (OPRD2) )!= RLT) \
+ __builtin_abort (); \
+} while (0)
+
+#define DECIMAL_LOGICAL_OR(OPRD) \
+do \
+{ \
+ OPRD = 1.0; \
+ OPERATE(1,||,OPRD,1); \
+ OPERATE(0,||,OPRD,1); \
+ OPERATE(OPRD,||,1,1); \
+ OPERATE(OPRD,||,0,1); \
+ OPRD = 0.0; \
+ OPERATE(1,||,OPRD,1); \
+ OPERATE(0,||,OPRD,0); \
+ OPERATE(OPRD,||,1,1); \
+ OPERATE(OPRD,||,0,0); \
+} while (0)
+
+#define DECIMAL_LOGICAL_AND(OPRD) \
+do \
+{ \
+ OPRD = 1.0; \
+ OPERATE(1,&&,OPRD,1); \
+ OPERATE(0,&&,OPRD,0); \
+ OPERATE(OPRD,&&,1,1); \
+ OPERATE(OPRD,&&,0,0); \
+ OPRD = 0.0; \
+ OPERATE(1,&&,OPRD,0); \
+ OPERATE(0,&&,OPRD,0); \
+ OPERATE(OPRD,&&,1,0); \
+ OPERATE(OPRD,&&,0,0); \
+} while (0)
+
+int
+main ()
+{
+ _Decimal32 d32;
+ _Decimal64 d64;
+ _Decimal128 d128;
+
+ /* C99 Section 6.5.{13,14} Logical operator. Constraints Each of the
+ operands shall have scalar type. DFP types would obey this. */
+ DECIMAL_LOGICAL_OR (d32);
+ DECIMAL_LOGICAL_AND (d32);
+
+ DECIMAL_LOGICAL_OR (d64);
+ DECIMAL_LOGICAL_AND (d64);
+
+ DECIMAL_LOGICAL_OR (d128);
+ DECIMAL_LOGICAL_AND (d128);
+
+ return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/operator-unary.c b/gcc/testsuite/c-c++-common/dfp/operator-unary.c
new file mode 100644
index 000000000..65f0be074
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/operator-unary.c
@@ -0,0 +1,52 @@
+/* C99 6.5.3 Unary operators. */
+
+#include "dfp-dbg.h"
+
+#define AUTO_INCREASE_DECREASE(TYPE,SUFFIX) \
+do \
+{ \
+ _Decimal##TYPE in_de_d##TYPE = 0.0##SUFFIX; \
+ if (in_de_d##TYPE++) FAILURE \
+ if (--in_de_d##TYPE) FAILURE \
+ if (++in_de_d##TYPE == 0.0##SUFFIX) FAILURE \
+ if (in_de_d##TYPE-- == 0.0##SUFFIX) FAILURE \
+} while(0)
+
+#define UNARY_OPERATOR(TYPE,SUFFIX) \
+do \
+{ \
+ _Decimal##TYPE unary_d##TYPE = 1.0##SUFFIX; \
+ _Decimal##TYPE* unary_dp##TYPE; \
+ /* & operator. */ \
+ unary_dp##TYPE = &(unary_d##TYPE); \
+ /* * operator. */ \
+ unary_d##TYPE = *(unary_dp##TYPE); \
+ /* - operator. */ \
+ unary_d##TYPE = -unary_d##TYPE; \
+ if (unary_d##TYPE != -1.0##SUFFIX) FAILURE \
+ /* + operator. */ \
+ unary_d##TYPE = +unary_d##TYPE; \
+ if (unary_d##TYPE != -1.0##SUFFIX) FAILURE \
+ if (!unary_d##TYPE) FAILURE /*! operator. */ \
+} while (0)
+
+int
+main ()
+{
+ /* C99 6.5.3.1 Prefix increment and decrement operators. */
+ AUTO_INCREASE_DECREASE(32, DF);
+ AUTO_INCREASE_DECREASE(64, DD);
+ AUTO_INCREASE_DECREASE(128, DL);
+
+ /* C99 6.5.3 Unary operators. */
+ UNARY_OPERATOR(32, DF);
+ UNARY_OPERATOR(64, DD);
+ UNARY_OPERATOR(128, DL);
+
+ /* C99 6.5.3 Unary operators for zero values. */
+ if (- +0.df != -0.df) FAILURE
+ if (+ -0.df != -0.df) FAILURE
+ if (- -0.df != +0.df) FAILURE
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/pr31385.c b/gcc/testsuite/c-c++-common/dfp/pr31385.c
new file mode 100644
index 000000000..fc024a3e6
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/pr31385.c
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+typedef float fp_t __attribute__((mode(SD)));
+
+extern fp_t g(fp_t);
+
+fp_t
+bug(fp_t x)
+{
+ fp_t result;
+ int n;
+ fp_t f, f3, y, z;
+
+ n = 0;
+ y = 1.DF;
+ f = g(x);
+
+ if (f < 0.DF)
+ f = -f;
+
+ f3 = 2.DF;
+
+ z = (y + y + f / (y * y));
+ y = (z + z) / (9.DF) + f3 / (z * z);
+
+ result = y;
+
+ return (result);
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/pr33466.c b/gcc/testsuite/c-c++-common/dfp/pr33466.c
new file mode 100644
index 000000000..e1cd76b74
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/pr33466.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+/* The suffix for a decimal float constant must use a single case.
+
+ These are invalid for all targets, not just those that support
+ decimal float. */
+
+long double dF = 4.5dF; /* { dg-error "invalid suffix" } */
+long double Df = 4.5Df; /* { dg-error "invalid suffix" } */
+long double dD = 4.5dD; /* { dg-error "invalid suffix" } */
+long double Dd = 4.5Dd; /* { dg-error "invalid suffix" } */
+long double dL = 4.5dL; /* { dg-error "invalid suffix" } */
+long double Dl = 4.5Dl; /* { dg-error "invalid suffix" } */
diff --git a/gcc/testsuite/c-c++-common/dfp/pr35620.c b/gcc/testsuite/c-c++-common/dfp/pr35620.c
new file mode 100644
index 000000000..2d56ab76b
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/pr35620.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+#ifdef __cplusplus
+typedef float _Decimal32 __attribute__((mode(SD)));
+#endif
+
+extern void foo (_Decimal32);
+_Decimal32 *p;
+
+extern int i;
+union U { _Decimal32 a; int b; } u;
+
+void
+blatz (void)
+{
+ _Decimal32 d;
+ u.b = i;
+ d = u.a;
+ foo (d);
+}
+
+void
+bar (void)
+{
+ foo (*p);
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/pr36800.c b/gcc/testsuite/c-c++-common/dfp/pr36800.c
new file mode 100644
index 000000000..76ff28c98
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/pr36800.c
@@ -0,0 +1,32 @@
+/* { dg-do run } */
+
+#include <stdarg.h>
+#include "dfp-dbg.h"
+
+void
+f (int a, ...)
+{
+ va_list ap;
+ if (a != 0)
+ FAILURE
+ va_start (ap, a);
+ if (va_arg (ap, _Decimal128) != 1.2DL)
+ FAILURE
+ if (va_arg (ap, _Decimal128) != 2.34DL)
+ FAILURE
+ if (va_arg (ap, _Decimal128) != 3.456DL)
+ FAILURE
+ if (va_arg (ap, _Decimal128) != 4.567DL)
+ FAILURE
+ if (va_arg (ap, double) != 5.125)
+ FAILURE
+ va_end (ap);
+}
+
+int
+main (void)
+{
+ f (0, 1.2DL, 2.34DL, 3.456DL, 4.567DL, 5.125);
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/pr39034.c b/gcc/testsuite/c-c++-common/dfp/pr39034.c
new file mode 100644
index 000000000..2a7eedbdb
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/pr39034.c
@@ -0,0 +1,100 @@
+/* { dg-do run } */
+/* { dg-options "-O" } */
+
+/* DFP TR 24732 == WG14 / N1176, N1312 */
+/* Based on a test from Fred Tydeman. */
+
+#include "dfp-dbg.h"
+
+/* Test runtime computations. */
+
+void
+runtime32 (void)
+{
+ volatile float v1 = 28.f, v2 = 3.f, v3 = 9.f, v4 = 31.f, v5 = 3.f, v6 = 10.f;
+ float b32 = (float)((v1/v2-v3) - (v4/v5-v6));
+ _Decimal32 d32 = (float)((v1/v2-v3) - (v4/v5-v6));
+
+ if (b32)
+ FAILURE
+ if (d32)
+ FAILURE
+}
+
+void
+runtime64 (void)
+{
+ volatile double v1 = 28., v2 = 3., v3 = 9., v4 = 31., v5 = 3., v6 = 10.;
+ double b64 = (double)((v1/v2-v3) - (v4/v5-v6));
+ _Decimal64 d64 = (double)((v1/v2-v3) - (v4/v5-v6));
+
+ if (b64)
+ FAILURE
+ if (d64)
+ FAILURE
+}
+
+void
+runtime128 (void)
+{
+ volatile long double v1 = 28.l, v2 = 3.l, v3 = 9.l,
+ v4 = 31.l, v5 = 3.l, v6 = 10.l;
+ long double b128 = (long double)((v1/v2-v3) - (v4/v5-v6));
+ _Decimal128 d128 = (long double)((v1/v2-v3) - (v4/v5-v6));
+
+ if (b128)
+ FAILURE
+ if (d128)
+ FAILURE
+}
+
+/* Test constant folding. */
+
+void
+fold32 (void)
+{
+ double d32 = (float)((28.f/3.f-9.f) - (31.f/3.f-10.f));
+ _Decimal32 b32 = (float)((28.f/3.f-9.f) - (31.f/3.f-10.f));
+
+ if (b32)
+ FAILURE
+ if (d32)
+ FAILURE
+}
+
+void
+fold64 (void)
+{
+ double b64 = (double)((28./3.-9.) - (31./3.-10.));
+ _Decimal64 d64 = (double)((28./3.-9.) - (31./3.-10.));
+
+ if (b64)
+ FAILURE
+ if (d64)
+ FAILURE
+}
+
+void
+fold128 (void)
+{
+ long double b128 = (long double)((28./3.-9.) - (31./3.-10.));
+ _Decimal128 d128 = (long double)((28./3.-9.) - (31./3.-10.));
+
+ if (b128)
+ FAILURE
+ if (d128)
+ FAILURE
+}
+
+int
+main ()
+{
+ runtime32 ();
+ runtime64 ();
+ runtime128 ();
+ fold32 ();
+ fold64 ();
+ fold128 ();
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/pr39035.c b/gcc/testsuite/c-c++-common/dfp/pr39035.c
new file mode 100644
index 000000000..2c9e8b386
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/pr39035.c
@@ -0,0 +1,71 @@
+/* { dg-do run } */
+/* { dg-options "-O" } */
+
+/* DFP TR 24732 == WG14 / N1176, N1312 */
+/* Based on a test from Fred Tydeman. */
+
+#include "dfp-dbg.h"
+
+/* Test runtime computations. */
+
+void
+runtime32 (void)
+{
+ volatile _Decimal32 d;
+ d = 0.0DF;
+ if (d)
+ FAILURE
+}
+
+void
+runtime64 (void)
+{
+ volatile _Decimal64 d;
+ d = 0.0DD;
+ if (d)
+ FAILURE
+}
+
+void
+runtime128 (void)
+{
+ volatile _Decimal128 d;
+ d = 0.0DL;
+ if (d)
+ FAILURE
+}
+
+void
+fold32 (void)
+{
+ if (0.0DF)
+ FAILURE
+}
+
+void
+fold64 (void)
+{
+ if (0.0DD)
+ FAILURE
+}
+
+void
+fold128 (void)
+{
+ if (0.0DL)
+ FAILURE
+}
+
+int
+main(void)
+{
+ runtime32 ();
+ runtime64 ();
+ runtime128 ();
+
+ fold32 ();
+ fold64 ();
+ fold128 ();
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/pr39902.c b/gcc/testsuite/c-c++-common/dfp/pr39902.c
new file mode 100644
index 000000000..847069966
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/pr39902.c
@@ -0,0 +1,226 @@
+/* Check that optimizations like (x * 1) to x, or (x * -1) to -x,
+ do not apply to decimal float computations where trailing zeroes
+ are significant. */
+
+#include "dfp-dbg.h"
+
+#define COMPARE32(A,B) \
+ A.i == B.i
+
+#define COMPARE64(A,B) \
+ A.i[0] == B.i[0] && A.i[1] == B.i[1]
+
+#define COMPARE128(A,B) \
+ A.i[0] == B.i[0] && A.i[1] == B.i[1] && A.i[2] == B.i[2] && A.i[3] == B.i[3]
+
+typedef union {
+ _Decimal32 d;
+ unsigned int i;
+} u32;
+
+typedef union {
+ _Decimal64 d;
+ unsigned int i[2];
+} u64;
+
+typedef union {
+ _Decimal128 d;
+ unsigned int i[4];
+} u128;
+
+volatile u32 p32_1;
+volatile u32 p32_1_0;
+volatile u32 p32_2_0;
+volatile u32 m32_1;
+volatile u32 m32_1_0;
+volatile u32 m32_2_0;
+volatile u32 a32;
+
+volatile u64 p64_1;
+volatile u64 p64_1_0;
+volatile u64 p64_2_0;
+volatile u64 m64_1;
+volatile u64 m64_1_0;
+volatile u64 m64_2_0;
+volatile u64 a64;
+
+volatile u128 p128_1;
+volatile u128 p128_1_0;
+volatile u128 p128_2_0;
+volatile u128 m128_1;
+volatile u128 m128_1_0;
+volatile u128 m128_2_0;
+volatile u128 a128;
+
+void
+init32 (void)
+{
+ p32_1.d = 1.DF;
+ p32_1_0.d = 1.0DF;
+ p32_2_0.d = 2.0DF;
+ m32_1.d = -1.DF;
+ m32_1_0.d = -1.0DF;
+ m32_2_0.d = -2.0DF;
+}
+
+void
+init64 (void)
+{
+ p64_1.d = 1.DD;
+ p64_1_0.d = 1.0DD;
+ p64_2_0.d = 2.0DD;
+ m64_1.d = -1.DD;
+ m64_1_0.d = -1.0DD;
+ m64_2_0.d = -2.0DD;
+}
+
+void
+init128 (void)
+{
+ p128_1.d = 1.DL;
+ p128_1_0.d = 1.0DL;
+ p128_2_0.d = 2.0DL;
+ m128_1.d = -1.DL;
+ m128_1_0.d = -1.0DL;
+ m128_2_0.d = -2.0DL;
+}
+
+void
+doit32 (void)
+{
+ /* Multiplying by a value with no trailing zero should not change the
+ quantum exponent. */
+
+ a32.d = p32_2_0.d * p32_1.d;
+ if (! (COMPARE32 (a32, p32_2_0)))
+ FAILURE
+
+ a32.d = p32_2_0.d * 1.DF;
+ if (! (COMPARE32 (a32, p32_2_0)))
+ FAILURE
+
+ a32.d = p32_2_0.d * m32_1.d;
+ if (! (COMPARE32 (a32, m32_2_0)))
+ FAILURE
+
+ a32.d = p32_2_0.d * -1.DF;
+ if (! (COMPARE32 (a32, m32_2_0)))
+ FAILURE
+
+ /* Multiplying by a value with a trailing zero should change the
+ quantum exponent. */
+
+ a32.d = p32_2_0.d * p32_1_0.d;
+ if (COMPARE32 (a32, p32_2_0))
+ FAILURE
+
+ a32.d = p32_2_0.d * 1.0DF;
+ if (COMPARE32 (a32, p32_2_0))
+ FAILURE
+
+ a32.d = p32_2_0.d * m32_1_0.d;
+ if (COMPARE32 (a32, m32_2_0))
+ FAILURE
+
+ a32.d = p32_2_0.d * -1.0DF;
+ if (COMPARE32 (a32, m32_2_0))
+ FAILURE
+}
+
+void
+doit64 (void)
+{
+ /* Multiplying by a value with no trailing zero should not change the
+ quantum exponent. */
+
+ a64.d = p64_2_0.d * p64_1.d;
+ if (! (COMPARE64 (a64, p64_2_0)))
+ FAILURE
+
+ a64.d = p64_2_0.d * 1.DD;
+ if (! (COMPARE64 (a64, p64_2_0)))
+ FAILURE
+
+ a64.d = p64_2_0.d * m64_1.d;
+ if (! (COMPARE64 (a64, m64_2_0)))
+ FAILURE
+
+ a64.d = p64_2_0.d * -1.DD;
+ if (! (COMPARE64 (a64, m64_2_0)))
+ FAILURE
+
+ /* Multiplying by a value with a trailing zero should change the
+ quantum exponent. */
+
+ a64.d = p64_2_0.d * p64_1_0.d;
+ if (COMPARE64 (a64, p64_2_0))
+ FAILURE
+
+ a64.d = p64_2_0.d * 1.0DD;
+ if (COMPARE64 (a64, p64_2_0))
+ FAILURE
+
+ a64.d = p64_2_0.d * m64_1_0.d;
+ if (COMPARE64 (a64, m64_2_0))
+ FAILURE
+
+ a64.d = p64_2_0.d * -1.0DD;
+ if (COMPARE64 (a64, m64_2_0))
+ FAILURE
+}
+
+void
+doit128 (void)
+{
+ /* Multiplying by a value with no trailing zero should not change the
+ quantum exponent. */
+
+ a128.d = p128_2_0.d * p128_1_0.d;
+ if (COMPARE128 (a128, p128_2_0))
+ FAILURE
+
+ a128.d = p128_2_0.d * 1.0DL;
+ if (COMPARE128 (a128, p128_2_0))
+ FAILURE
+
+ a128.d = p128_2_0.d * m128_1_0.d;
+ if (COMPARE128 (a128, m128_2_0))
+ FAILURE
+
+ a128.d = p128_2_0.d * -1.0DL;
+ if (COMPARE128 (a128, m128_2_0))
+ FAILURE
+
+ /* Multiplying by a value with a trailing zero should change the
+ quantum exponent. */
+
+ a128.d = p128_2_0.d * p128_1.d;
+ if (! (COMPARE128 (a128, p128_2_0)))
+ FAILURE
+
+ a128.d = p128_2_0.d * 1.DL;
+ if (! (COMPARE128 (a128, p128_2_0)))
+ FAILURE
+
+ a128.d = p128_2_0.d * m128_1.d;
+ if (! (COMPARE128 (a128, m128_2_0)))
+ FAILURE
+
+ a128.d = p128_2_0.d * -1.DL;
+ if (! (COMPARE128 (a128, m128_2_0)))
+ FAILURE
+}
+
+int
+main (void)
+{
+ init32 ();
+ init64 ();
+ init128 ();
+
+ doit32 ();
+ doit64 ();
+ doit128 ();
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/pr39986.c b/gcc/testsuite/c-c++-common/dfp/pr39986.c
new file mode 100644
index 000000000..e7c9ce982
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/pr39986.c
@@ -0,0 +1,32 @@
+/* { dg-do compile } */
+
+#include "dfp-dbg.h"
+
+/* Check that the compiler generates the correct decimal float constants. */
+
+_Decimal32 a = 100.223df;
+_Decimal32 b = -2.3df;
+_Decimal64 c = 3.4e-4dd;
+_Decimal64 d = -4.500dd;
+_Decimal128 e = 5678901234567.89e+200dl;
+_Decimal128 f = -678901.234e-6dl;
+
+/* The first value is DPD, the second is BID. The order differs depending
+ on whether the target is big-endian or little-endian. */
+
+/* { dg-final { scan-assembler ".long\t(572653859|822183807)\n" } } */
+
+/* { dg-final { scan-assembler ".long\t(-1572863965|-1308622825)\n" } } */
+
+/* { dg-final { scan-assembler ".long\t(52|34)\n" } } */
+/* { dg-final { scan-assembler ".long\t(572784640|824180736)\n" } } */
+
+/* { dg-final { scan-assembler ".long\t(4736|4500)\n" } } */
+/* { dg-final { scan-assembler ".long\t(-1574174720|-1319108608)\n" } } */
+
+/* { dg-final { scan-assembler ".long\t(-1975952433|957645077)\n" } } */
+/* { dg-final { scan-assembler ".long\t(190215|132222)\n" } } */
+/* { dg-final { scan-assembler ".long\t(574193664|835452928)\n" } } */
+
+/* { dg-final { scan-assembler ".long\t(931280180|678901234)\n" } } */
+/* { dg-final { scan-assembler ".long\t(-1576681472|-1339162624)\n" } } */
diff --git a/gcc/testsuite/c-c++-common/dfp/signbit-1.c b/gcc/testsuite/c-c++-common/dfp/signbit-1.c
new file mode 100644
index 000000000..d83d2a48e
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/signbit-1.c
@@ -0,0 +1,40 @@
+/* { dg-options "-O0" } */
+
+/* Decimal float versions of __builtin_signbit. */
+
+#include "dfp-dbg.h"
+
+#define CHECK32(D,I) \
+ if ((__builtin_signbitd32 (D) != 0) != I) FAILURE
+
+#define CHECK64(D,I) \
+ if ((__builtin_signbitd64 (D) != 0) != I) FAILURE
+
+#define CHECK128(D,I) \
+ if ((__builtin_signbitd128 (D) != 0) != I) FAILURE
+
+/* Prevent the compiler from folding the calls at compile time. */
+volatile _Decimal32 sd;
+volatile _Decimal64 dd;
+volatile _Decimal128 td;
+
+int
+main ()
+{
+ sd = 1.9df; CHECK32 (sd, 0)
+ sd = -5.3df; CHECK32 (sd, 1)
+ sd = 0.0df; CHECK32 (sd, 0)
+ sd = -0.0df; CHECK32 (sd, 1)
+
+ dd = 1.9dd; CHECK64 (dd, 0)
+ dd = -5.3dd; CHECK64 (dd, 1)
+ dd = 0.0dd; CHECK64 (dd, 0)
+ dd = -0.0dd; CHECK64 (dd, 1)
+
+ td = 1.9dl; CHECK128 (td, 0)
+ td = -5.3dl; CHECK128 (td, 1)
+ td = 0.0dl; CHECK128 (td, 0)
+ td = -0.0dl; CHECK128 (td, 1)
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/signbit-2.c b/gcc/testsuite/c-c++-common/dfp/signbit-2.c
new file mode 100644
index 000000000..e51bf918b
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/signbit-2.c
@@ -0,0 +1,33 @@
+/* { dg-options "-O0" } */
+
+/* Check that the compiler uses builtins for signbit; if not the link
+ will fail because library functions are in libm. */
+
+#include "dfp-dbg.h"
+
+volatile _Decimal32 sd = 2.3df;
+volatile _Decimal64 dd = -4.5dd;
+volatile _Decimal128 tf = 5.3dl;
+volatile float f = 1.2f;
+volatile double d = -7.8;
+volatile long double ld = 3.4L;
+
+EXTERN int signbitf (float);
+EXTERN int signbit (double);
+EXTERN int signbitl (long double);
+EXTERN int signbitd32 (_Decimal32);
+EXTERN int signbitd64 (_Decimal64);
+EXTERN int signbitd128 (_Decimal128);
+
+int
+main ()
+{
+ if (signbitf (f) != 0) FAILURE
+ if (signbit (d) == 0) FAILURE
+ if (signbitl (ld) != 0) FAILURE
+ if (signbitd32 (sd) != 0) FAILURE
+ if (signbitd64 (dd) == 0) FAILURE
+ if (signbitd128 (tf) != 0) FAILURE
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/struct-layout-1.c b/gcc/testsuite/c-c++-common/dfp/struct-layout-1.c
new file mode 100644
index 000000000..2a9d7304f
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/struct-layout-1.c
@@ -0,0 +1,71 @@
+#include <stdarg.h>
+#include "dfp-dbg.h"
+
+struct S1
+{
+ _Decimal64 a[0];
+};
+
+struct S2
+{
+ struct
+ {
+ _Decimal64 e;
+ } b[0];
+};
+
+struct S3
+{
+ union
+ {
+ _Decimal64 c;
+ } a[0];
+};
+
+struct S4
+{
+ int a[0];
+ _Decimal64 b[0];
+};
+
+struct S5
+{
+ union
+ {
+ _Decimal64 c[0];
+ } a;
+};
+
+int check_var (int z, ...)
+{
+ long long result;
+ va_list ap;
+ va_start (ap, z);
+ va_arg (ap, struct S1);
+ result = va_arg (ap, long long);
+ va_end (ap);
+
+ return (result == 2LL);
+}
+
+int main ()
+{
+ struct S1 s1;
+ struct S2 s2;
+ struct S3 s3;
+ struct S4 s4;
+ struct S5 s5;
+
+ if (check_var (2, s1, 2LL) == 0)
+ FAILURE;
+ if (check_var (2, s2, 2LL) == 0)
+ FAILURE;
+ if (check_var (2, s3, 2LL) == 0)
+ FAILURE;
+ if (check_var (2, s4, 2LL) == 0)
+ FAILURE;
+ if (check_var (2, s5, 2LL) == 0)
+ FAILURE;
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/usual-arith-conv-const.c b/gcc/testsuite/c-c++-common/dfp/usual-arith-conv-const.c
new file mode 100644
index 000000000..2d72bba42
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/usual-arith-conv-const.c
@@ -0,0 +1,32 @@
+/* { dg-do compile } */
+
+/* Test various conversions involving decimal floating types. */
+
+#include "dfp-dbg.h"
+
+/* Assertion that constant C is of type T. */
+#define ASSERT_CONST_TYPE(C, T) \
+ do { \
+ typedef T type; \
+ typedef type **typepp; \
+ typedef __typeof__((C)) ctype; \
+ typedef ctype **ctypepp; \
+ typepp x = 0; \
+ ctypepp y = 0; \
+ x = y; \
+ y = x; \
+ } while (0)
+
+int
+main ()
+{
+ ASSERT_CONST_TYPE (3 + 2.1df, _Decimal32); /* { dg-bogus "assignment from incompatible pointer type" } */
+ ASSERT_CONST_TYPE (1.3df + 2, _Decimal32); /* { dg-bogus "assignment from incompatible pointer type" } */
+ ASSERT_CONST_TYPE (56U - 55.0dd, _Decimal64); /* { dg-bogus "assignment from incompatible pointer type" } */
+ ASSERT_CONST_TYPE (5 * .2DL, _Decimal128); /* { dg-bogus "assignment from incompatible pointer type" } */
+ ASSERT_CONST_TYPE (.88dl / 2L, _Decimal128); /* { dg-bogus "assignment from incompatible pointer type" } */
+ ASSERT_CONST_TYPE (.114df - 1.6dd, _Decimal64); /* { dg-bogus "assignment from incompatible pointer type" } */
+ ASSERT_CONST_TYPE (3L - 1 + .55df, _Decimal32); /* { dg-bogus "assignment from incompatible pointer type" } */
+
+ return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/dfp/usual-arith-conv.c b/gcc/testsuite/c-c++-common/dfp/usual-arith-conv.c
new file mode 100644
index 000000000..baff06bc1
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dfp/usual-arith-conv.c
@@ -0,0 +1,117 @@
+/* { dg-options "-O0" } */
+
+/* N1150 5.4: Usual arithmetic conversions.
+ C99 6.3.1.8[1] (New).
+
+ Test arithmetic operators with different decimal float types, and
+ between decimal float types and integer types. */
+
+#include "dfp-dbg.h"
+
+volatile _Decimal32 d32a, d32b, d32c;
+volatile _Decimal64 d64a, d64b, d64c;
+volatile _Decimal128 d128a, d128b, d128c;
+volatile int i;
+
+void
+init ()
+{
+ d32b = 123.456e94df;
+ d64b = 12.3456789012345e383dd;
+ d128b = 12345.6789012345678901e4000dl;
+
+ d32c = 1.3df;
+ d64c = 1.2dd;
+ d128c = 1.1dl;
+
+ i = 2;
+}
+
+int
+main ()
+{
+ init ();
+
+ /* Usual arithmetic conversions between decimal float types; addition. */
+ d128a = d128b + d32b;
+ if (d128a < d128b)
+ FAILURE
+ d128a = d32b + d128b;
+ if (d128a < d128b)
+ FAILURE
+ d128a = d128b + d64b;
+ if (d128a < d128b)
+ FAILURE
+ d128a = d64b + d128b;
+ if (d128a < d128b)
+ FAILURE
+ d64a = d64b + d32b;
+ if (d64a < d64b)
+ FAILURE
+ d64a = d32b + d64b;
+ if (d64a < d64b)
+ FAILURE
+
+ /* Usual arithmetic conversions between decimal float types;
+ multiplication. */
+ d128a = d128b * d32c;
+ if (d128a < d128b)
+ FAILURE
+ d128a = d32c * d128b;
+ if (d128a < d128b)
+ FAILURE
+ d128a = d128b * d64c;
+ if (d128a < d128b)
+ FAILURE
+ d128a = d64c * d128b;
+ if (d128a < d128b)
+ FAILURE
+ d64a = d64b * d32c;
+ if (d64a < d64b)
+ FAILURE
+ d64a = d32c * d64b;
+ if (d64a < d64b)
+ FAILURE
+
+ /* Usual arithmetic conversions between decimal float and integer types. */
+ d32a = d32c + i;
+ if (d32a != d32c + 2.0df)
+ FAILURE
+ d32a = d32c - i;
+ if (d32a != d32c - 2.0df)
+ FAILURE
+ d32a = i * d32c;
+ if (d32a != d32c + d32c)
+ FAILURE
+ d32a = d32c / i;
+ if (d32a != d32c / 2.0df)
+ FAILURE
+
+ d64a = i + d64c;
+ if (d64a != d64c + 2.0dd)
+ FAILURE
+ d64a = d64c - i;
+ if (d64a != d64c - 2.0dd)
+ FAILURE
+ d64a = d64c * i;
+ if (d64a != d64c + d64c)
+ FAILURE
+ d64a = d64c / i;
+ if (d64a != d64c / 2.0dd)
+ FAILURE
+
+ d128a = d128c + i;
+ if (d128a != d128c + 2.0dl)
+ FAILURE
+ d128a = d128c - i;
+ if (d128a != d128c - 2.0dl)
+ FAILURE
+ d128a = i * d128c;
+ if (d128a != d128c + d128c)
+ FAILURE
+ d128a = d128c / i;
+ if (d128a != d128c / 2.0dl)
+ FAILURE
+
+ FINISH
+}
diff --git a/gcc/testsuite/c-c++-common/dwarf2/pr43190.c b/gcc/testsuite/c-c++-common/dwarf2/pr43190.c
new file mode 100644
index 000000000..2cb1b7086
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dwarf2/pr43190.c
@@ -0,0 +1,13 @@
+/* PR debug/43190 */
+/* { dg-options "-gdwarf-2 -dA" } */
+/* { dg-final { scan-assembler "DW_TAG_structure_type\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\"S\[^\\r\\n\]*DW_AT_name" } } */
+/* { dg-final { scan-assembler "DW_TAG_typedef\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\"T\[^\\r\\n\]*DW_AT_name" } } */
+
+typedef struct S { int i; } *T;
+#define M(p) ((T) (p))
+
+void
+foo (void *p)
+{
+ M (p)->i++;
+}
diff --git a/gcc/testsuite/c-c++-common/dwarf2/vla1.c b/gcc/testsuite/c-c++-common/dwarf2/vla1.c
new file mode 100644
index 000000000..e814bf568
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dwarf2/vla1.c
@@ -0,0 +1,11 @@
+// PR debug/42800
+// { dg-options "-gdwarf-2 -dA" }
+// { dg-final { scan-assembler "DW_AT_upper_bound" } }
+
+int
+f (int i)
+{
+ char a[i];
+
+ return a[0];
+}
diff --git a/gcc/testsuite/c-c++-common/fmax-errors.c b/gcc/testsuite/c-c++-common/fmax-errors.c
new file mode 100644
index 000000000..1ef78eb9e
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/fmax-errors.c
@@ -0,0 +1,11 @@
+/* PR c/44782 */
+/* { dg-do compile } */
+/* { dg-options "-fmax-errors=3" } */
+
+void foo (unsigned int i, unsigned int j)
+{
+ (i) (); /* { dg-error "" } */
+ (j) (); /* { dg-error "" } */
+ (i+j) (); /* { dg-error "" } */
+ (i*j) (); /* no error here due to -fmax-errors */
+} /* { dg-prune-output "compilation terminated" } */
diff --git a/gcc/testsuite/c-c++-common/guality/pr43141.c b/gcc/testsuite/c-c++-common/guality/pr43141.c
new file mode 100644
index 000000000..e6fe79a0e
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/guality/pr43141.c
@@ -0,0 +1,16 @@
+/* { dg-do run } */
+/* { dg-options "-g" } */
+
+int i;
+static int f(int) __attribute ((noinline));
+static int f(int x)
+{
+ return i;
+}
+
+int main()
+{
+ return f(42);
+}
+
+/* { dg-final { gdb-test 8 "sizeof (x)" "sizeof (int)" } } */
diff --git a/gcc/testsuite/c-c++-common/int128-1.c b/gcc/testsuite/c-c++-common/int128-1.c
new file mode 100644
index 000000000..dafb2a993
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/int128-1.c
@@ -0,0 +1,41 @@
+/* { dg-do run { target int128 } } */
+/* { dg-options "-std=gnu99" { target c } } */
+/* { dg-options "" { target c++ } } */
+
+#include <stdarg.h>
+
+#ifndef __cplusplus
+extern void abort (void);
+#else
+extern "C" void abort (void);
+#endif
+
+#define MK_CONST128(A,B,C,D) \
+ ( (((unsigned __int128) (unsigned int) A) << 96) \
+ | (((unsigned __int128) (unsigned int) B) << 64) \
+ | (((unsigned __int128) (unsigned int) C) << 32) \
+ | ((unsigned __int128) (unsigned int) D) )
+
+#define MK_CONST128_SIGNED(A,B,C,D) \
+ ((__int128) MK_CONST128(A, B, C, D))
+
+void foo(int i, ...)
+{
+ __int128 q;
+ va_list va;
+
+ va_start(va, i);
+ q = va_arg(va, __int128);
+ va_end(va);
+
+ if (q != MK_CONST128_SIGNED (0xfeffffffU, 2U, 3U, 4U))
+ abort();
+}
+
+int main(void)
+{
+ __int128 q = MK_CONST128_SIGNED (0xfeffffffU, 2U, 3U, 4U);
+
+ foo(1, q);
+ return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/int128-2.c b/gcc/testsuite/c-c++-common/int128-2.c
new file mode 100644
index 000000000..36042b022
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/int128-2.c
@@ -0,0 +1,157 @@
+/* { dg-do run { target int128 } } */
+/* { dg-options "-std=gnu99" { target c } } */
+/* { dg-options "" { target c++ } } */
+
+#ifndef __cplusplus
+extern void abort (void);
+#else
+extern "C" void abort (void);
+#endif
+
+#define MK_CONST128(A,B,C,D) \
+ ( (((unsigned __int128) (unsigned int) A) << 96) \
+ | (((unsigned __int128) (unsigned int) B) << 64) \
+ | (((unsigned __int128) (unsigned int) C) << 32) \
+ | ((unsigned __int128) (unsigned int) D) )
+
+#define MK_CONST128_SIGNED(A,B,C,D) \
+ ((__int128) MK_CONST128(A, B, C, D))
+
+#define MINUS_2 MK_CONST128_SIGNED (0xffffffffu, 0xffffffffu, 0xffffffffu, \
+ 0xfffffffeu)
+#define MINUS_3 MK_CONST128_SIGNED (0xffffffffu, 0xffffffffu, 0xffffffffu, \
+ 0xfffffffdu)
+#define MINUS_6 MK_CONST128_SIGNED (0xffffffffu, 0xffffffffu, 0xffffffffu, \
+ 0xfffffffau)
+#define PLUS_1 MK_CONST128_SIGNED (0, 0, 0, 1)
+#define PLUS_2 MK_CONST128_SIGNED (0, 0, 0, 2)
+#define PLUS_3 MK_CONST128_SIGNED (0, 0, 0, 3)
+#define PLUS_6 MK_CONST128_SIGNED (0, 0, 0, 6)
+#define PLUS_10 MK_CONST128_SIGNED (0, 0, 0, 10)
+
+#define U_8 MK_CONST128 (0, 0, 0, 8)
+#define U_MAX MK_CONST128 (0xffffffff,0xffffffff,0xffffffff,0xffffffff)
+#define U_CST1 MK_CONST128 (0xbeeffeed, 0xdeafcafe, 0xaffefade, 0x12345678)
+#define U_CST2 MK_CONST128 (0x41100112, 0x21503501, 0x50010521, 0xedcba987)
+
+signed __int128 foo_neg (signed __int128 v)
+{
+ return -v;
+}
+
+unsigned __int128 foo_xor (unsigned __int128 x, unsigned __int128 y)
+{
+ return x ^ y;
+}
+
+unsigned __int128 foo_inv (unsigned __int128 v)
+{
+ return ~v;
+}
+
+unsigned __int128 foo_rotate_left (unsigned __int128 v)
+{
+ unsigned __int128 c;
+ int i;
+ for (i = 0; i < 128; i++)
+ {
+ c = v >> 127;
+ v <<= 1;
+ v |= c;
+ }
+ return v;
+}
+
+unsigned __int128 foo_rotate_right (unsigned __int128 v)
+{
+ unsigned __int128 c;
+ int i;
+ for (i = 0; i < 128; i++)
+ {
+ c = (v & ((unsigned __int128) 1)) << 127;
+ v >>= 1;
+ v |= c;
+ }
+ return v;
+}
+
+void foo_swap (unsigned __int128 *x, unsigned __int128 *y)
+{
+ unsigned __int128 x1 = x[0];
+ unsigned __int128 y1 = y[0];
+ x1 ^= y1 ^= x1 ^= y1;
+ x[0] = x1;
+ y[0] = y1;
+}
+
+__int128 foo_add (signed __int128 a, unsigned __int128 b)
+{
+ return (__int128) (a + (__int128) b);
+}
+
+__int128 foo_sub (unsigned __int128 a, signed __int128 b)
+{
+ return (__int128) ((__int128) a - b);
+}
+
+__int128 foo_mul (signed __int128 a, signed __int128 b)
+{
+ return a * b;
+}
+
+__int128 foo_div (signed __int128 a, signed __int128 b)
+{
+ return a / b;
+}
+
+__int128 foo_shl (signed __int128 a, int shift)
+{
+ return a << (shift & 127);
+}
+
+__int128 foo_shr (signed __int128 a, int shift)
+{
+ return a >> (shift & 127);
+}
+
+int main(void)
+{
+ __int128 rslt;
+ unsigned __int128 u1, u2;
+
+ rslt = foo_add (MINUS_2, U_8);
+ if (rslt != PLUS_6)
+ abort ();
+ rslt = foo_sub (U_8, MINUS_2);
+ if (rslt != PLUS_10)
+ abort ();
+ rslt = foo_sub ((unsigned __int128) foo_mul (MINUS_2, MINUS_2), MINUS_2);
+ if (rslt != PLUS_6)
+ abort ();
+ if (rslt != foo_shl (PLUS_3, 1))
+ abort ();
+ rslt = foo_shl (MINUS_3, 1);
+ if (rslt != MINUS_6)
+ abort ();
+ if (foo_shr (MINUS_6, 1) != MINUS_3)
+ abort ();
+ if (foo_div (MINUS_6, MINUS_3) != PLUS_2)
+ abort ();
+ if (foo_rotate_left (U_CST1) != U_CST1)
+ abort ();
+ if (foo_rotate_right (U_CST1) != U_CST1)
+ abort ();
+ u1 = U_CST1;
+ u2 = U_8;
+ foo_swap (&u1, &u2);
+ if (u1 != U_8 || u2 != U_CST1)
+ abort ();
+
+ if (foo_inv (U_CST2) != U_CST1)
+ abort ();
+ if (foo_neg (PLUS_2) != MINUS_2)
+ abort ();
+ if (foo_neg ((signed __int128) U_CST1) != foo_add (PLUS_1, foo_xor (U_CST1, U_MAX)))
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/int128-types-1.c b/gcc/testsuite/c-c++-common/int128-types-1.c
new file mode 100644
index 000000000..7bee8fcd3
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/int128-types-1.c
@@ -0,0 +1,666 @@
+/* Test for valid and invalid combinations of type specifiers using __int128.
+ */
+/* Origin: Kai Tietz <kai.tietz@onevision.com> */
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-std=gnu99" { target c } } */
+/* { dg-options "" { target c++ } } */
+
+typedef char type;
+__int128 *x0;
+void __int128 *x1; /* { dg-error "" } */
+char __int128 *x2; /* { dg-error "" } */
+short __int128 *x3; /* { dg-error "" } */
+int __int128 *x4; /* { dg-error "" } */
+__int128 void *x5; /* { dg-error "" } */
+__int128 char *x6; /* { dg-error "" } */
+__int128 short *x7; /* { dg-error "" } */
+__int128 int *x8; /* { dg-error "" } */
+__int128 __int128 *x9; /* { dg-error "" } */
+__int128 long *x10; /* { dg-error "" } */
+__int128 float *x11; /* { dg-error "" } */
+__int128 double *x12; /* { dg-error "" } */
+__int128 signed *x13;
+__int128 unsigned *x14;
+__int128 _Bool *x15; /* { dg-error "" } */
+__int128 _Complex *x16;
+long __int128 *x17; /* { dg-error "" } */
+float __int128 *x18; /* { dg-error "" } */
+double __int128 *x19; /* { dg-error "" } */
+signed __int128 *x20;
+unsigned __int128 *x21;
+_Bool __int128 *x22; /* { dg-error "" } */
+_Complex __int128 *x23;
+type __int128 *x24; /* { dg-error "" } */
+char signed __int128 *x25; /* { dg-error "" } */
+char unsigned __int128 *x26; /* { dg-error "" } */
+char _Complex __int128 *x27; /* { dg-error "" } */
+short int __int128 *x28; /* { dg-error "" } */
+short signed __int128 *x29; /* { dg-error "" } */
+short unsigned __int128 *x30; /* { dg-error "" } */
+short _Complex __int128 *x31; /* { dg-error "" } */
+int short __int128 *x32; /* { dg-error "" } */
+int long __int128 *x33; /* { dg-error "" } */
+int signed __int128 *x34; /* { dg-error "" } */
+int unsigned __int128 *x35; /* { dg-error "" } */
+int _Complex __int128 *x36; /* { dg-error "" } */
+__int128 signed void *x37; /* { dg-error "" } */
+__int128 signed char *x38; /* { dg-error "" } */
+__int128 signed short *x39; /* { dg-error "" } */
+__int128 signed int *x40; /* { dg-error "" } */
+__int128 signed __int128 *x41; /* { dg-error "" } */
+__int128 signed long *x42; /* { dg-error "" } */
+__int128 signed float *x43; /* { dg-error "" } */
+__int128 signed double *x44; /* { dg-error "" } */
+__int128 signed signed *x45; /* { dg-error "" } */
+__int128 signed unsigned *x46; /* { dg-error "" } */
+__int128 signed _Bool *x47; /* { dg-error "" } */
+__int128 signed _Complex *x48;
+__int128 unsigned void *x49; /* { dg-error "" } */
+__int128 unsigned char *x50; /* { dg-error "" } */
+__int128 unsigned short *x51; /* { dg-error "" } */
+__int128 unsigned int *x52; /* { dg-error "" } */
+__int128 unsigned __int128 *x53; /* { dg-error "" } */
+__int128 unsigned long *x54; /* { dg-error "" } */
+__int128 unsigned float *x55; /* { dg-error "" } */
+__int128 unsigned double *x56; /* { dg-error "" } */
+__int128 unsigned signed *x57; /* { dg-error "" } */
+__int128 unsigned unsigned *x58; /* { dg-error "" } */
+__int128 unsigned _Bool *x59; /* { dg-error "" } */
+__int128 unsigned _Complex *x60;
+__int128 _Complex void *x61; /* { dg-error "" } */
+__int128 _Complex char *x62; /* { dg-error "" } */
+__int128 _Complex short *x63; /* { dg-error "" } */
+__int128 _Complex int *x64; /* { dg-error "" } */
+__int128 _Complex __int128 *x65; /* { dg-error "" } */
+__int128 _Complex long *x66; /* { dg-error "" } */
+__int128 _Complex float *x67; /* { dg-error "" } */
+__int128 _Complex double *x68; /* { dg-error "" } */
+__int128 _Complex signed *x69;
+__int128 _Complex unsigned *x70;
+__int128 _Complex _Bool *x71; /* { dg-error "" } */
+__int128 _Complex _Complex *x72; /* { dg-error "" } */
+long int __int128 *x73; /* { dg-error "" } */
+long long __int128 *x74; /* { dg-error "" } */
+long double __int128 *x75; /* { dg-error "" } */
+long signed __int128 *x76; /* { dg-error "" } */
+long unsigned __int128 *x77; /* { dg-error "" } */
+long _Complex __int128 *x78; /* { dg-error "" } */
+float _Complex __int128 *x79; /* { dg-error "" } */
+double long __int128 *x80; /* { dg-error "" } */
+double _Complex __int128 *x81; /* { dg-error "" } */
+signed char __int128 *x82; /* { dg-error "" } */
+signed short __int128 *x83; /* { dg-error "" } */
+signed int __int128 *x84; /* { dg-error "" } */
+signed __int128 void *x85; /* { dg-error "" } */
+signed __int128 char *x86; /* { dg-error "" } */
+signed __int128 short *x87; /* { dg-error "" } */
+signed __int128 int *x88; /* { dg-error "" } */
+signed __int128 __int128 *x89; /* { dg-error "" } */
+signed __int128 long *x90; /* { dg-error "" } */
+signed __int128 float *x91; /* { dg-error "" } */
+signed __int128 double *x92; /* { dg-error "" } */
+signed __int128 signed *x93; /* { dg-error "" } */
+signed __int128 unsigned *x94; /* { dg-error "" } */
+signed __int128 _Bool *x95; /* { dg-error "" } */
+signed __int128 _Complex *x96;
+signed long __int128 *x97; /* { dg-error "" } */
+signed _Complex __int128 *x98;
+unsigned char __int128 *x99; /* { dg-error "" } */
+unsigned short __int128 *x100; /* { dg-error "" } */
+unsigned int __int128 *x101; /* { dg-error "" } */
+unsigned __int128 void *x102; /* { dg-error "" } */
+unsigned __int128 char *x103; /* { dg-error "" } */
+unsigned __int128 short *x104; /* { dg-error "" } */
+unsigned __int128 int *x105; /* { dg-error "" } */
+unsigned __int128 __int128 *x106; /* { dg-error "" } */
+unsigned __int128 long *x107; /* { dg-error "" } */
+unsigned __int128 float *x108; /* { dg-error "" } */
+unsigned __int128 double *x109; /* { dg-error "" } */
+unsigned __int128 signed *x110; /* { dg-error "" } */
+unsigned __int128 unsigned *x111; /* { dg-error "" } */
+unsigned __int128 _Bool *x112; /* { dg-error "" } */
+unsigned __int128 _Complex *x113;
+unsigned long __int128 *x114; /* { dg-error "" } */
+unsigned _Complex __int128 *x115;
+_Complex char __int128 *x116; /* { dg-error "" } */
+_Complex short __int128 *x117; /* { dg-error "" } */
+_Complex int __int128 *x118; /* { dg-error "" } */
+_Complex __int128 void *x119; /* { dg-error "" } */
+_Complex __int128 char *x120; /* { dg-error "" } */
+_Complex __int128 short *x121; /* { dg-error "" } */
+_Complex __int128 int *x122; /* { dg-error "" } */
+_Complex __int128 __int128 *x123; /* { dg-error "" } */
+_Complex __int128 long *x124; /* { dg-error "" } */
+_Complex __int128 float *x125; /* { dg-error "" } */
+_Complex __int128 double *x126; /* { dg-error "" } */
+_Complex __int128 signed *x127;
+_Complex __int128 unsigned *x128;
+_Complex __int128 _Bool *x129; /* { dg-error "" } */
+_Complex __int128 _Complex *x130; /* { dg-error "" } */
+_Complex long __int128 *x131; /* { dg-error "" } */
+_Complex float __int128 *x132; /* { dg-error "" } */
+_Complex double __int128 *x133; /* { dg-error "" } */
+_Complex signed __int128 *x134;
+_Complex unsigned __int128 *x135;
+char signed _Complex __int128 *x136; /* { dg-error "" } */
+char unsigned _Complex __int128 *x137; /* { dg-error "" } */
+char _Complex signed __int128 *x138; /* { dg-error "" } */
+char _Complex unsigned __int128 *x139; /* { dg-error "" } */
+short int signed __int128 *x140; /* { dg-error "" } */
+short int unsigned __int128 *x141; /* { dg-error "" } */
+short int _Complex __int128 *x142; /* { dg-error "" } */
+short signed int __int128 *x143; /* { dg-error "" } */
+short signed _Complex __int128 *x144; /* { dg-error "" } */
+short unsigned int __int128 *x145; /* { dg-error "" } */
+short unsigned _Complex __int128 *x146; /* { dg-error "" } */
+short _Complex int __int128 *x147; /* { dg-error "" } */
+short _Complex signed __int128 *x148; /* { dg-error "" } */
+short _Complex unsigned __int128 *x149; /* { dg-error "" } */
+int short signed __int128 *x150; /* { dg-error "" } */
+int short unsigned __int128 *x151; /* { dg-error "" } */
+int short _Complex __int128 *x152; /* { dg-error "" } */
+int long long __int128 *x153; /* { dg-error "" } */
+int long signed __int128 *x154; /* { dg-error "" } */
+int long unsigned __int128 *x155; /* { dg-error "" } */
+int long _Complex __int128 *x156; /* { dg-error "" } */
+int signed short __int128 *x157; /* { dg-error "" } */
+int signed long __int128 *x158; /* { dg-error "" } */
+int signed _Complex __int128 *x159; /* { dg-error "" } */
+int unsigned short __int128 *x160; /* { dg-error "" } */
+int unsigned long __int128 *x161; /* { dg-error "" } */
+int unsigned _Complex __int128 *x162; /* { dg-error "" } */
+int _Complex short __int128 *x163; /* { dg-error "" } */
+int _Complex long __int128 *x164; /* { dg-error "" } */
+int _Complex signed __int128 *x165; /* { dg-error "" } */
+int _Complex unsigned __int128 *x166; /* { dg-error "" } */
+__int128 signed _Complex void *x167; /* { dg-error "" } */
+__int128 signed _Complex char *x168; /* { dg-error "" } */
+__int128 signed _Complex short *x169; /* { dg-error "" } */
+__int128 signed _Complex int *x170; /* { dg-error "" } */
+__int128 signed _Complex __int128 *x171; /* { dg-error "" } */
+__int128 signed _Complex long *x172; /* { dg-error "" } */
+__int128 signed _Complex float *x173; /* { dg-error "" } */
+__int128 signed _Complex double *x174; /* { dg-error "" } */
+__int128 signed _Complex signed *x175; /* { dg-error "" } */
+__int128 signed _Complex unsigned *x176; /* { dg-error "" } */
+__int128 signed _Complex _Bool *x177; /* { dg-error "" } */
+__int128 signed _Complex _Complex *x178; /* { dg-error "" } */
+__int128 unsigned _Complex void *x179; /* { dg-error "" } */
+__int128 unsigned _Complex char *x180; /* { dg-error "" } */
+__int128 unsigned _Complex short *x181; /* { dg-error "" } */
+__int128 unsigned _Complex int *x182; /* { dg-error "" } */
+__int128 unsigned _Complex __int128 *x183; /* { dg-error "" } */
+__int128 unsigned _Complex long *x184; /* { dg-error "" } */
+__int128 unsigned _Complex float *x185; /* { dg-error "" } */
+__int128 unsigned _Complex double *x186; /* { dg-error "" } */
+__int128 unsigned _Complex signed *x187; /* { dg-error "" } */
+__int128 unsigned _Complex unsigned *x188; /* { dg-error "" } */
+__int128 unsigned _Complex _Bool *x189; /* { dg-error "" } */
+__int128 unsigned _Complex _Complex *x190; /* { dg-error "" } */
+__int128 _Complex signed void *x191; /* { dg-error "" } */
+__int128 _Complex signed char *x192; /* { dg-error "" } */
+__int128 _Complex signed short *x193; /* { dg-error "" } */
+__int128 _Complex signed int *x194; /* { dg-error "" } */
+__int128 _Complex signed __int128 *x195; /* { dg-error "" } */
+__int128 _Complex signed long *x196; /* { dg-error "" } */
+__int128 _Complex signed float *x197; /* { dg-error "" } */
+__int128 _Complex signed double *x198; /* { dg-error "" } */
+__int128 _Complex signed signed *x199; /* { dg-error "" } */
+__int128 _Complex signed unsigned *x200; /* { dg-error "" } */
+__int128 _Complex signed _Bool *x201; /* { dg-error "" } */
+__int128 _Complex signed _Complex *x202; /* { dg-error "" } */
+__int128 _Complex unsigned void *x203; /* { dg-error "" } */
+__int128 _Complex unsigned char *x204; /* { dg-error "" } */
+__int128 _Complex unsigned short *x205; /* { dg-error "" } */
+__int128 _Complex unsigned int *x206; /* { dg-error "" } */
+__int128 _Complex unsigned __int128 *x207; /* { dg-error "" } */
+__int128 _Complex unsigned long *x208; /* { dg-error "" } */
+__int128 _Complex unsigned float *x209; /* { dg-error "" } */
+__int128 _Complex unsigned double *x210; /* { dg-error "" } */
+__int128 _Complex unsigned signed *x211; /* { dg-error "" } */
+__int128 _Complex unsigned unsigned *x212; /* { dg-error "" } */
+__int128 _Complex unsigned _Bool *x213; /* { dg-error "" } */
+__int128 _Complex unsigned _Complex *x214; /* { dg-error "" } */
+long int long __int128 *x215; /* { dg-error "" } */
+long int signed __int128 *x216; /* { dg-error "" } */
+long int unsigned __int128 *x217; /* { dg-error "" } */
+long int _Complex __int128 *x218; /* { dg-error "" } */
+long long int __int128 *x219; /* { dg-error "" } */
+long long signed __int128 *x220; /* { dg-error "" } */
+long long unsigned __int128 *x221; /* { dg-error "" } */
+long long _Complex __int128 *x222; /* { dg-error "" } */
+long double _Complex __int128 *x223; /* { dg-error "" } */
+long signed int __int128 *x224; /* { dg-error "" } */
+long signed long __int128 *x225; /* { dg-error "" } */
+long signed _Complex __int128 *x226; /* { dg-error "" } */
+long unsigned int __int128 *x227; /* { dg-error "" } */
+long unsigned long __int128 *x228; /* { dg-error "" } */
+long unsigned _Complex __int128 *x229; /* { dg-error "" } */
+long _Complex int __int128 *x230; /* { dg-error "" } */
+long _Complex long __int128 *x231; /* { dg-error "" } */
+long _Complex double __int128 *x232; /* { dg-error "" } */
+long _Complex signed __int128 *x233; /* { dg-error "" } */
+long _Complex unsigned __int128 *x234; /* { dg-error "" } */
+double long _Complex __int128 *x235; /* { dg-error "" } */
+double _Complex long __int128 *x236; /* { dg-error "" } */
+signed char _Complex __int128 *x237; /* { dg-error "" } */
+signed short int __int128 *x238; /* { dg-error "" } */
+signed short _Complex __int128 *x239; /* { dg-error "" } */
+signed int short __int128 *x240; /* { dg-error "" } */
+signed int long __int128 *x241; /* { dg-error "" } */
+signed int _Complex __int128 *x242; /* { dg-error "" } */
+signed __int128 _Complex void *x243; /* { dg-error "" } */
+signed __int128 _Complex char *x244; /* { dg-error "" } */
+signed __int128 _Complex short *x245; /* { dg-error "" } */
+signed __int128 _Complex int *x246; /* { dg-error "" } */
+signed __int128 _Complex __int128 *x247; /* { dg-error "" } */
+signed __int128 _Complex long *x248; /* { dg-error "" } */
+signed __int128 _Complex float *x249; /* { dg-error "" } */
+signed __int128 _Complex double *x250; /* { dg-error "" } */
+signed __int128 _Complex signed *x251; /* { dg-error "" } */
+signed __int128 _Complex unsigned *x252; /* { dg-error "" } */
+signed __int128 _Complex _Bool *x253; /* { dg-error "" } */
+signed __int128 _Complex _Complex *x254; /* { dg-error "" } */
+signed long int __int128 *x255; /* { dg-error "" } */
+signed long long __int128 *x256; /* { dg-error "" } */
+signed long _Complex __int128 *x257; /* { dg-error "" } */
+signed _Complex char __int128 *x258; /* { dg-error "" } */
+signed _Complex short __int128 *x259; /* { dg-error "" } */
+signed _Complex int __int128 *x260; /* { dg-error "" } */
+signed _Complex __int128 void *x261; /* { dg-error "" } */
+signed _Complex __int128 char *x262; /* { dg-error "" } */
+signed _Complex __int128 short *x263; /* { dg-error "" } */
+signed _Complex __int128 int *x264; /* { dg-error "" } */
+signed _Complex __int128 __int128 *x265; /* { dg-error "" } */
+signed _Complex __int128 long *x266; /* { dg-error "" } */
+signed _Complex __int128 float *x267; /* { dg-error "" } */
+signed _Complex __int128 double *x268; /* { dg-error "" } */
+signed _Complex __int128 signed *x269; /* { dg-error "" } */
+signed _Complex __int128 unsigned *x270; /* { dg-error "" } */
+signed _Complex __int128 _Bool *x271; /* { dg-error "" } */
+signed _Complex __int128 _Complex *x272; /* { dg-error "" } */
+signed _Complex long __int128 *x273; /* { dg-error "" } */
+unsigned char _Complex __int128 *x274; /* { dg-error "" } */
+unsigned short int __int128 *x275; /* { dg-error "" } */
+unsigned short _Complex __int128 *x276; /* { dg-error "" } */
+unsigned int short __int128 *x277; /* { dg-error "" } */
+unsigned int long __int128 *x278; /* { dg-error "" } */
+unsigned int _Complex __int128 *x279; /* { dg-error "" } */
+unsigned __int128 _Complex void *x280; /* { dg-error "" } */
+unsigned __int128 _Complex char *x281; /* { dg-error "" } */
+unsigned __int128 _Complex short *x282; /* { dg-error "" } */
+unsigned __int128 _Complex int *x283; /* { dg-error "" } */
+unsigned __int128 _Complex __int128 *x284; /* { dg-error "" } */
+unsigned __int128 _Complex long *x285; /* { dg-error "" } */
+unsigned __int128 _Complex float *x286; /* { dg-error "" } */
+unsigned __int128 _Complex double *x287; /* { dg-error "" } */
+unsigned __int128 _Complex signed *x288; /* { dg-error "" } */
+unsigned __int128 _Complex unsigned *x289; /* { dg-error "" } */
+unsigned __int128 _Complex _Bool *x290; /* { dg-error "" } */
+unsigned __int128 _Complex _Complex *x291; /* { dg-error "" } */
+unsigned long int __int128 *x292; /* { dg-error "" } */
+unsigned long long __int128 *x293; /* { dg-error "" } */
+unsigned long _Complex __int128 *x294; /* { dg-error "" } */
+unsigned _Complex char __int128 *x295; /* { dg-error "" } */
+unsigned _Complex short __int128 *x296; /* { dg-error "" } */
+unsigned _Complex int __int128 *x297; /* { dg-error "" } */
+unsigned _Complex __int128 void *x298; /* { dg-error "" } */
+unsigned _Complex __int128 char *x299; /* { dg-error "" } */
+unsigned _Complex __int128 short *x300; /* { dg-error "" } */
+unsigned _Complex __int128 int *x301; /* { dg-error "" } */
+unsigned _Complex __int128 __int128 *x302; /* { dg-error "" } */
+unsigned _Complex __int128 long *x303; /* { dg-error "" } */
+unsigned _Complex __int128 float *x304; /* { dg-error "" } */
+unsigned _Complex __int128 double *x305; /* { dg-error "" } */
+unsigned _Complex __int128 signed *x306; /* { dg-error "" } */
+unsigned _Complex __int128 unsigned *x307; /* { dg-error "" } */
+unsigned _Complex __int128 _Bool *x308; /* { dg-error "" } */
+unsigned _Complex __int128 _Complex *x309; /* { dg-error "" } */
+unsigned _Complex long __int128 *x310; /* { dg-error "" } */
+_Complex char signed __int128 *x311; /* { dg-error "" } */
+_Complex char unsigned __int128 *x312; /* { dg-error "" } */
+_Complex short int __int128 *x313; /* { dg-error "" } */
+_Complex short signed __int128 *x314; /* { dg-error "" } */
+_Complex short unsigned __int128 *x315; /* { dg-error "" } */
+_Complex int short __int128 *x316; /* { dg-error "" } */
+_Complex int long __int128 *x317; /* { dg-error "" } */
+_Complex int signed __int128 *x318; /* { dg-error "" } */
+_Complex int unsigned __int128 *x319; /* { dg-error "" } */
+_Complex __int128 signed void *x320; /* { dg-error "" } */
+_Complex __int128 signed char *x321; /* { dg-error "" } */
+_Complex __int128 signed short *x322; /* { dg-error "" } */
+_Complex __int128 signed int *x323; /* { dg-error "" } */
+_Complex __int128 signed __int128 *x324; /* { dg-error "" } */
+_Complex __int128 signed long *x325; /* { dg-error "" } */
+_Complex __int128 signed float *x326; /* { dg-error "" } */
+_Complex __int128 signed double *x327; /* { dg-error "" } */
+_Complex __int128 signed signed *x328; /* { dg-error "" } */
+_Complex __int128 signed unsigned *x329; /* { dg-error "" } */
+_Complex __int128 signed _Bool *x330; /* { dg-error "" } */
+_Complex __int128 signed _Complex *x331; /* { dg-error "" } */
+_Complex __int128 unsigned void *x332; /* { dg-error "" } */
+_Complex __int128 unsigned char *x333; /* { dg-error "" } */
+_Complex __int128 unsigned short *x334; /* { dg-error "" } */
+_Complex __int128 unsigned int *x335; /* { dg-error "" } */
+_Complex __int128 unsigned __int128 *x336; /* { dg-error "" } */
+_Complex __int128 unsigned long *x337; /* { dg-error "" } */
+_Complex __int128 unsigned float *x338; /* { dg-error "" } */
+_Complex __int128 unsigned double *x339; /* { dg-error "" } */
+_Complex __int128 unsigned signed *x340; /* { dg-error "" } */
+_Complex __int128 unsigned unsigned *x341; /* { dg-error "" } */
+_Complex __int128 unsigned _Bool *x342; /* { dg-error "" } */
+_Complex __int128 unsigned _Complex *x343; /* { dg-error "" } */
+_Complex long int __int128 *x344; /* { dg-error "" } */
+_Complex long long __int128 *x345; /* { dg-error "" } */
+_Complex long double __int128 *x346; /* { dg-error "" } */
+_Complex long signed __int128 *x347; /* { dg-error "" } */
+_Complex long unsigned __int128 *x348; /* { dg-error "" } */
+_Complex double long __int128 *x349; /* { dg-error "" } */
+_Complex signed char __int128 *x350; /* { dg-error "" } */
+_Complex signed short __int128 *x351; /* { dg-error "" } */
+_Complex signed int __int128 *x352; /* { dg-error "" } */
+_Complex signed __int128 void *x353; /* { dg-error "" } */
+_Complex signed __int128 char *x354; /* { dg-error "" } */
+_Complex signed __int128 short *x355; /* { dg-error "" } */
+_Complex signed __int128 int *x356; /* { dg-error "" } */
+_Complex signed __int128 __int128 *x357; /* { dg-error "" } */
+_Complex signed __int128 long *x358; /* { dg-error "" } */
+_Complex signed __int128 float *x359; /* { dg-error "" } */
+_Complex signed __int128 double *x360; /* { dg-error "" } */
+_Complex signed __int128 signed *x361; /* { dg-error "" } */
+_Complex signed __int128 unsigned *x362; /* { dg-error "" } */
+_Complex signed __int128 _Bool *x363; /* { dg-error "" } */
+_Complex signed __int128 _Complex *x364; /* { dg-error "" } */
+_Complex signed long __int128 *x365; /* { dg-error "" } */
+_Complex unsigned char __int128 *x366; /* { dg-error "" } */
+_Complex unsigned short __int128 *x367; /* { dg-error "" } */
+_Complex unsigned int __int128 *x368; /* { dg-error "" } */
+_Complex unsigned __int128 void *x369; /* { dg-error "" } */
+_Complex unsigned __int128 char *x370; /* { dg-error "" } */
+_Complex unsigned __int128 short *x371; /* { dg-error "" } */
+_Complex unsigned __int128 int *x372; /* { dg-error "" } */
+_Complex unsigned __int128 __int128 *x373; /* { dg-error "" } */
+_Complex unsigned __int128 long *x374; /* { dg-error "" } */
+_Complex unsigned __int128 float *x375; /* { dg-error "" } */
+_Complex unsigned __int128 double *x376; /* { dg-error "" } */
+_Complex unsigned __int128 signed *x377; /* { dg-error "" } */
+_Complex unsigned __int128 unsigned *x378; /* { dg-error "" } */
+_Complex unsigned __int128 _Bool *x379; /* { dg-error "" } */
+_Complex unsigned __int128 _Complex *x380; /* { dg-error "" } */
+_Complex unsigned long __int128 *x381; /* { dg-error "" } */
+short int signed _Complex __int128 *x382; /* { dg-error "" } */
+short int unsigned _Complex __int128 *x383; /* { dg-error "" } */
+short int _Complex signed __int128 *x384; /* { dg-error "" } */
+short int _Complex unsigned __int128 *x385; /* { dg-error "" } */
+short signed int _Complex __int128 *x386; /* { dg-error "" } */
+short signed _Complex int __int128 *x387; /* { dg-error "" } */
+short unsigned int _Complex __int128 *x388; /* { dg-error "" } */
+short unsigned _Complex int __int128 *x389; /* { dg-error "" } */
+short _Complex int signed __int128 *x390; /* { dg-error "" } */
+short _Complex int unsigned __int128 *x391; /* { dg-error "" } */
+short _Complex signed int __int128 *x392; /* { dg-error "" } */
+short _Complex unsigned int __int128 *x393; /* { dg-error "" } */
+int short signed _Complex __int128 *x394; /* { dg-error "" } */
+int short unsigned _Complex __int128 *x395; /* { dg-error "" } */
+int short _Complex signed __int128 *x396; /* { dg-error "" } */
+int short _Complex unsigned __int128 *x397; /* { dg-error "" } */
+int long long signed __int128 *x398; /* { dg-error "" } */
+int long long unsigned __int128 *x399; /* { dg-error "" } */
+int long long _Complex __int128 *x400; /* { dg-error "" } */
+int long signed long __int128 *x401; /* { dg-error "" } */
+int long signed _Complex __int128 *x402; /* { dg-error "" } */
+int long unsigned long __int128 *x403; /* { dg-error "" } */
+int long unsigned _Complex __int128 *x404; /* { dg-error "" } */
+int long _Complex long __int128 *x405; /* { dg-error "" } */
+int long _Complex signed __int128 *x406; /* { dg-error "" } */
+int long _Complex unsigned __int128 *x407; /* { dg-error "" } */
+int signed short _Complex __int128 *x408; /* { dg-error "" } */
+int signed long long __int128 *x409; /* { dg-error "" } */
+int signed long _Complex __int128 *x410; /* { dg-error "" } */
+int signed _Complex short __int128 *x411; /* { dg-error "" } */
+int signed _Complex long __int128 *x412; /* { dg-error "" } */
+int unsigned short _Complex __int128 *x413; /* { dg-error "" } */
+int unsigned long long __int128 *x414; /* { dg-error "" } */
+int unsigned long _Complex __int128 *x415; /* { dg-error "" } */
+int unsigned _Complex short __int128 *x416; /* { dg-error "" } */
+int unsigned _Complex long __int128 *x417; /* { dg-error "" } */
+int _Complex short signed __int128 *x418; /* { dg-error "" } */
+int _Complex short unsigned __int128 *x419; /* { dg-error "" } */
+int _Complex long long __int128 *x420; /* { dg-error "" } */
+int _Complex long signed __int128 *x421; /* { dg-error "" } */
+int _Complex long unsigned __int128 *x422; /* { dg-error "" } */
+int _Complex signed short __int128 *x423; /* { dg-error "" } */
+int _Complex signed long __int128 *x424; /* { dg-error "" } */
+int _Complex unsigned short __int128 *x425; /* { dg-error "" } */
+int _Complex unsigned long __int128 *x426; /* { dg-error "" } */
+long int long signed __int128 *x427; /* { dg-error "" } */
+long int long unsigned __int128 *x428; /* { dg-error "" } */
+long int long _Complex __int128 *x429; /* { dg-error "" } */
+long int signed long __int128 *x430; /* { dg-error "" } */
+long int signed _Complex __int128 *x431; /* { dg-error "" } */
+long int unsigned long __int128 *x432; /* { dg-error "" } */
+long int unsigned _Complex __int128 *x433; /* { dg-error "" } */
+long int _Complex long __int128 *x434; /* { dg-error "" } */
+long int _Complex signed __int128 *x435; /* { dg-error "" } */
+long int _Complex unsigned __int128 *x436; /* { dg-error "" } */
+long long int signed __int128 *x437; /* { dg-error "" } */
+long long int unsigned __int128 *x438; /* { dg-error "" } */
+long long int _Complex __int128 *x439; /* { dg-error "" } */
+long long signed int __int128 *x440; /* { dg-error "" } */
+long long signed _Complex __int128 *x441; /* { dg-error "" } */
+long long unsigned int __int128 *x442; /* { dg-error "" } */
+long long unsigned _Complex __int128 *x443; /* { dg-error "" } */
+long long _Complex int __int128 *x444; /* { dg-error "" } */
+long long _Complex signed __int128 *x445; /* { dg-error "" } */
+long long _Complex unsigned __int128 *x446; /* { dg-error "" } */
+long signed int long __int128 *x447; /* { dg-error "" } */
+long signed int _Complex __int128 *x448; /* { dg-error "" } */
+long signed long int __int128 *x449; /* { dg-error "" } */
+long signed long _Complex __int128 *x450; /* { dg-error "" } */
+long signed _Complex int __int128 *x451; /* { dg-error "" } */
+long signed _Complex long __int128 *x452; /* { dg-error "" } */
+long unsigned int long __int128 *x453; /* { dg-error "" } */
+long unsigned int _Complex __int128 *x454; /* { dg-error "" } */
+long unsigned long int __int128 *x455; /* { dg-error "" } */
+long unsigned long _Complex __int128 *x456; /* { dg-error "" } */
+long unsigned _Complex int __int128 *x457; /* { dg-error "" } */
+long unsigned _Complex long __int128 *x458; /* { dg-error "" } */
+long _Complex int long __int128 *x459; /* { dg-error "" } */
+long _Complex int signed __int128 *x460; /* { dg-error "" } */
+long _Complex int unsigned __int128 *x461; /* { dg-error "" } */
+long _Complex long int __int128 *x462; /* { dg-error "" } */
+long _Complex long signed __int128 *x463; /* { dg-error "" } */
+long _Complex long unsigned __int128 *x464; /* { dg-error "" } */
+long _Complex signed int __int128 *x465; /* { dg-error "" } */
+long _Complex signed long __int128 *x466; /* { dg-error "" } */
+long _Complex unsigned int __int128 *x467; /* { dg-error "" } */
+long _Complex unsigned long __int128 *x468; /* { dg-error "" } */
+signed short int _Complex __int128 *x469; /* { dg-error "" } */
+signed short _Complex int __int128 *x470; /* { dg-error "" } */
+signed int short _Complex __int128 *x471; /* { dg-error "" } */
+signed int long long __int128 *x472; /* { dg-error "" } */
+signed int long _Complex __int128 *x473; /* { dg-error "" } */
+signed int _Complex short __int128 *x474; /* { dg-error "" } */
+signed int _Complex long __int128 *x475; /* { dg-error "" } */
+signed long int long __int128 *x476; /* { dg-error "" } */
+signed long int _Complex __int128 *x477; /* { dg-error "" } */
+signed long long int __int128 *x478; /* { dg-error "" } */
+signed long long _Complex __int128 *x479; /* { dg-error "" } */
+signed long _Complex int __int128 *x480; /* { dg-error "" } */
+signed long _Complex long __int128 *x481; /* { dg-error "" } */
+signed _Complex short int __int128 *x482; /* { dg-error "" } */
+signed _Complex int short __int128 *x483; /* { dg-error "" } */
+signed _Complex int long __int128 *x484; /* { dg-error "" } */
+signed _Complex long int __int128 *x485; /* { dg-error "" } */
+signed _Complex long long __int128 *x486; /* { dg-error "" } */
+unsigned short int _Complex __int128 *x487; /* { dg-error "" } */
+unsigned short _Complex int __int128 *x488; /* { dg-error "" } */
+unsigned int short _Complex __int128 *x489; /* { dg-error "" } */
+unsigned int long long __int128 *x490; /* { dg-error "" } */
+unsigned int long _Complex __int128 *x491; /* { dg-error "" } */
+unsigned int _Complex short __int128 *x492; /* { dg-error "" } */
+unsigned int _Complex long __int128 *x493; /* { dg-error "" } */
+unsigned long int long __int128 *x494; /* { dg-error "" } */
+unsigned long int _Complex __int128 *x495; /* { dg-error "" } */
+unsigned long long int __int128 *x496; /* { dg-error "" } */
+unsigned long long _Complex __int128 *x497; /* { dg-error "" } */
+unsigned long _Complex int __int128 *x498; /* { dg-error "" } */
+unsigned long _Complex long __int128 *x499; /* { dg-error "" } */
+unsigned _Complex short int __int128 *x500; /* { dg-error "" } */
+unsigned _Complex int short __int128 *x501; /* { dg-error "" } */
+unsigned _Complex int long __int128 *x502; /* { dg-error "" } */
+unsigned _Complex long int __int128 *x503; /* { dg-error "" } */
+unsigned _Complex long long __int128 *x504; /* { dg-error "" } */
+_Complex short int signed __int128 *x505; /* { dg-error "" } */
+_Complex short int unsigned __int128 *x506; /* { dg-error "" } */
+_Complex short signed int __int128 *x507; /* { dg-error "" } */
+_Complex short unsigned int __int128 *x508; /* { dg-error "" } */
+_Complex int short signed __int128 *x509; /* { dg-error "" } */
+_Complex int short unsigned __int128 *x510; /* { dg-error "" } */
+_Complex int long long __int128 *x511; /* { dg-error "" } */
+_Complex int long signed __int128 *x512; /* { dg-error "" } */
+_Complex int long unsigned __int128 *x513; /* { dg-error "" } */
+_Complex int signed short __int128 *x514; /* { dg-error "" } */
+_Complex int signed long __int128 *x515; /* { dg-error "" } */
+_Complex int unsigned short __int128 *x516; /* { dg-error "" } */
+_Complex int unsigned long __int128 *x517; /* { dg-error "" } */
+_Complex long int long __int128 *x518; /* { dg-error "" } */
+_Complex long int signed __int128 *x519; /* { dg-error "" } */
+_Complex long int unsigned __int128 *x520; /* { dg-error "" } */
+_Complex long long int __int128 *x521; /* { dg-error "" } */
+_Complex long long signed __int128 *x522; /* { dg-error "" } */
+_Complex long long unsigned __int128 *x523; /* { dg-error "" } */
+_Complex long signed int __int128 *x524; /* { dg-error "" } */
+_Complex long signed long __int128 *x525; /* { dg-error "" } */
+_Complex long unsigned int __int128 *x526; /* { dg-error "" } */
+_Complex long unsigned long __int128 *x527; /* { dg-error "" } */
+_Complex signed short int __int128 *x528; /* { dg-error "" } */
+_Complex signed int short __int128 *x529; /* { dg-error "" } */
+_Complex signed int long __int128 *x530; /* { dg-error "" } */
+_Complex signed long int __int128 *x531; /* { dg-error "" } */
+_Complex signed long long __int128 *x532; /* { dg-error "" } */
+_Complex unsigned short int __int128 *x533; /* { dg-error "" } */
+_Complex unsigned int short __int128 *x534; /* { dg-error "" } */
+_Complex unsigned int long __int128 *x535; /* { dg-error "" } */
+_Complex unsigned long int __int128 *x536; /* { dg-error "" } */
+_Complex unsigned long long __int128 *x537; /* { dg-error "" } */
+int long long signed _Complex __int128 *x538; /* { dg-error "" } */
+int long long unsigned _Complex __int128 *x539; /* { dg-error "" } */
+int long long _Complex signed __int128 *x540; /* { dg-error "" } */
+int long long _Complex unsigned __int128 *x541; /* { dg-error "" } */
+int long signed long _Complex __int128 *x542; /* { dg-error "" } */
+int long signed _Complex long __int128 *x543; /* { dg-error "" } */
+int long unsigned long _Complex __int128 *x544; /* { dg-error "" } */
+int long unsigned _Complex long __int128 *x545; /* { dg-error "" } */
+int long _Complex long signed __int128 *x546; /* { dg-error "" } */
+int long _Complex long unsigned __int128 *x547; /* { dg-error "" } */
+int long _Complex signed long __int128 *x548; /* { dg-error "" } */
+int long _Complex unsigned long __int128 *x549; /* { dg-error "" } */
+int signed long long _Complex __int128 *x550; /* { dg-error "" } */
+int signed long _Complex long __int128 *x551; /* { dg-error "" } */
+int signed _Complex long long __int128 *x552; /* { dg-error "" } */
+int unsigned long long _Complex __int128 *x553; /* { dg-error "" } */
+int unsigned long _Complex long __int128 *x554; /* { dg-error "" } */
+int unsigned _Complex long long __int128 *x555; /* { dg-error "" } */
+int _Complex long long signed __int128 *x556; /* { dg-error "" } */
+int _Complex long long unsigned __int128 *x557; /* { dg-error "" } */
+int _Complex long signed long __int128 *x558; /* { dg-error "" } */
+int _Complex long unsigned long __int128 *x559; /* { dg-error "" } */
+int _Complex signed long long __int128 *x560; /* { dg-error "" } */
+int _Complex unsigned long long __int128 *x561; /* { dg-error "" } */
+long int long signed _Complex __int128 *x562; /* { dg-error "" } */
+long int long unsigned _Complex __int128 *x563; /* { dg-error "" } */
+long int long _Complex signed __int128 *x564; /* { dg-error "" } */
+long int long _Complex unsigned __int128 *x565; /* { dg-error "" } */
+long int signed long _Complex __int128 *x566; /* { dg-error "" } */
+long int signed _Complex long __int128 *x567; /* { dg-error "" } */
+long int unsigned long _Complex __int128 *x568; /* { dg-error "" } */
+long int unsigned _Complex long __int128 *x569; /* { dg-error "" } */
+long int _Complex long signed __int128 *x570; /* { dg-error "" } */
+long int _Complex long unsigned __int128 *x571; /* { dg-error "" } */
+long int _Complex signed long __int128 *x572; /* { dg-error "" } */
+long int _Complex unsigned long __int128 *x573; /* { dg-error "" } */
+long long int signed _Complex __int128 *x574; /* { dg-error "" } */
+long long int unsigned _Complex __int128 *x575; /* { dg-error "" } */
+long long int _Complex signed __int128 *x576; /* { dg-error "" } */
+long long int _Complex unsigned __int128 *x577; /* { dg-error "" } */
+long long signed int _Complex __int128 *x578; /* { dg-error "" } */
+long long signed _Complex int __int128 *x579; /* { dg-error "" } */
+long long unsigned int _Complex __int128 *x580; /* { dg-error "" } */
+long long unsigned _Complex int __int128 *x581; /* { dg-error "" } */
+long long _Complex int signed __int128 *x582; /* { dg-error "" } */
+long long _Complex int unsigned __int128 *x583; /* { dg-error "" } */
+long long _Complex signed int __int128 *x584; /* { dg-error "" } */
+long long _Complex unsigned int __int128 *x585; /* { dg-error "" } */
+long signed int long _Complex __int128 *x586; /* { dg-error "" } */
+long signed int _Complex long __int128 *x587; /* { dg-error "" } */
+long signed long int _Complex __int128 *x588; /* { dg-error "" } */
+long signed long _Complex int __int128 *x589; /* { dg-error "" } */
+long signed _Complex int long __int128 *x590; /* { dg-error "" } */
+long signed _Complex long int __int128 *x591; /* { dg-error "" } */
+long unsigned int long _Complex __int128 *x592; /* { dg-error "" } */
+long unsigned int _Complex long __int128 *x593; /* { dg-error "" } */
+long unsigned long int _Complex __int128 *x594; /* { dg-error "" } */
+long unsigned long _Complex int __int128 *x595; /* { dg-error "" } */
+long unsigned _Complex int long __int128 *x596; /* { dg-error "" } */
+long unsigned _Complex long int __int128 *x597; /* { dg-error "" } */
+long _Complex int long signed __int128 *x598; /* { dg-error "" } */
+long _Complex int long unsigned __int128 *x599; /* { dg-error "" } */
+long _Complex int signed long __int128 *x600; /* { dg-error "" } */
+long _Complex int unsigned long __int128 *x601; /* { dg-error "" } */
+long _Complex long int signed __int128 *x602; /* { dg-error "" } */
+long _Complex long int unsigned __int128 *x603; /* { dg-error "" } */
+long _Complex long signed int __int128 *x604; /* { dg-error "" } */
+long _Complex long unsigned int __int128 *x605; /* { dg-error "" } */
+long _Complex signed int long __int128 *x606; /* { dg-error "" } */
+long _Complex signed long int __int128 *x607; /* { dg-error "" } */
+long _Complex unsigned int long __int128 *x608; /* { dg-error "" } */
+long _Complex unsigned long int __int128 *x609; /* { dg-error "" } */
+signed int long long _Complex __int128 *x610; /* { dg-error "" } */
+signed int long _Complex long __int128 *x611; /* { dg-error "" } */
+signed int _Complex long long __int128 *x612; /* { dg-error "" } */
+signed long int long _Complex __int128 *x613; /* { dg-error "" } */
+signed long int _Complex long __int128 *x614; /* { dg-error "" } */
+signed long long int _Complex __int128 *x615; /* { dg-error "" } */
+signed long long _Complex int __int128 *x616; /* { dg-error "" } */
+signed long _Complex int long __int128 *x617; /* { dg-error "" } */
+signed long _Complex long int __int128 *x618; /* { dg-error "" } */
+signed _Complex int long long __int128 *x619; /* { dg-error "" } */
+signed _Complex long int long __int128 *x620; /* { dg-error "" } */
+signed _Complex long long int __int128 *x621; /* { dg-error "" } */
+unsigned int long long _Complex __int128 *x622; /* { dg-error "" } */
+unsigned int long _Complex long __int128 *x623; /* { dg-error "" } */
+unsigned int _Complex long long __int128 *x624; /* { dg-error "" } */
+unsigned long int long _Complex __int128 *x625; /* { dg-error "" } */
+unsigned long int _Complex long __int128 *x626; /* { dg-error "" } */
+unsigned long long int _Complex __int128 *x627; /* { dg-error "" } */
+unsigned long long _Complex int __int128 *x628; /* { dg-error "" } */
+unsigned long _Complex int long __int128 *x629; /* { dg-error "" } */
+unsigned long _Complex long int __int128 *x630; /* { dg-error "" } */
+unsigned _Complex int long long __int128 *x631; /* { dg-error "" } */
+unsigned _Complex long int long __int128 *x632; /* { dg-error "" } */
+unsigned _Complex long long int __int128 *x633; /* { dg-error "" } */
+_Complex int long long signed __int128 *x634; /* { dg-error "" } */
+_Complex int long long unsigned __int128 *x635; /* { dg-error "" } */
+_Complex int long signed long __int128 *x636; /* { dg-error "" } */
+_Complex int long unsigned long __int128 *x637; /* { dg-error "" } */
+_Complex int signed long long __int128 *x638; /* { dg-error "" } */
+_Complex int unsigned long long __int128 *x639; /* { dg-error "" } */
+_Complex long int long signed __int128 *x640; /* { dg-error "" } */
+_Complex long int long unsigned __int128 *x641; /* { dg-error "" } */
+_Complex long int signed long __int128 *x642; /* { dg-error "" } */
+_Complex long int unsigned long __int128 *x643; /* { dg-error "" } */
+_Complex long long int signed __int128 *x644; /* { dg-error "" } */
+_Complex long long int unsigned __int128 *x645; /* { dg-error "" } */
+_Complex long long signed int __int128 *x646; /* { dg-error "" } */
+_Complex long long unsigned int __int128 *x647; /* { dg-error "" } */
+_Complex long signed int long __int128 *x648; /* { dg-error "" } */
+_Complex long signed long int __int128 *x649; /* { dg-error "" } */
+_Complex long unsigned int long __int128 *x650; /* { dg-error "" } */
+_Complex long unsigned long int __int128 *x651; /* { dg-error "" } */
+_Complex signed int long long __int128 *x652; /* { dg-error "" } */
+_Complex signed long int long __int128 *x653; /* { dg-error "" } */
+_Complex signed long long int __int128 *x654; /* { dg-error "" } */
+_Complex unsigned int long long __int128 *x655; /* { dg-error "" } */
+_Complex unsigned long int long __int128 *x656; /* { dg-error "" } */
+_Complex unsigned long long int __int128 *x657; /* { dg-error "" } */
diff --git a/gcc/testsuite/c-c++-common/pr20000.c b/gcc/testsuite/c-c++-common/pr20000.c
new file mode 100644
index 000000000..3c0fb8841
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr20000.c
@@ -0,0 +1,32 @@
+/* PR c/20000 We only want to warn if the function returns
+ explicitly. We do not care about the return type. */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+int g(void) __attribute__((noreturn));
+int g2(void) __attribute__((noreturn)); /* { dg-bogus ".noreturn. function returns non-void value" } */
+void h(void) __attribute__((noreturn));
+
+
+int g(void) {
+ return 1; /* { dg-warning "function declared 'noreturn' has a 'return' statement" } */
+} /* { dg-warning "'noreturn' function does return" "" { target *-*-* } 12 } */
+
+int g2(void) {
+ h();
+}
+
+typedef int ft(void);
+volatile ft vg;
+volatile ft vg2;
+
+int vg(void);
+int vg2(void); /* { dg-bogus ".noreturn. function returns non-void value" } */
+
+int vg(void) {
+ return 1; /* { dg-warning "function declared 'noreturn' has a 'return' statement" "" { target c } 27 } */
+} /* { dg-warning "'noreturn' function does return" "" { target c } 27 } */
+
+int vg2(void) {
+ h();
+}
diff --git a/gcc/testsuite/c-c++-common/pr33193.c b/gcc/testsuite/c-c++-common/pr33193.c
new file mode 100644
index 000000000..2d1929848
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr33193.c
@@ -0,0 +1,19 @@
+/* PR c/33193 */
+/* { dg-do compile } */
+
+struct a {float x, y; };
+
+float f(struct a b)
+{
+ /* The error messages here are different between C and C++, so just
+ make sure we get an error. */
+ float x = __real b; /* { dg-error "" } */
+ float y = __imag b; /* { dg-error "" } */
+ return x / y;
+}
+int f1(int *b)
+{
+ float x = __imag b; /* { dg-error "wrong type argument" } */
+ float y = __real b; /* { dg-error "wrong type argument" } */
+ return x - y;
+}
diff --git a/gcc/testsuite/c-c++-common/pr33763.c b/gcc/testsuite/c-c++-common/pr33763.c
new file mode 100644
index 000000000..dbdfa77fc
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr33763.c
@@ -0,0 +1,60 @@
+/* PR tree-optimization/33763 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+typedef struct
+{
+ void *a;
+ void *b;
+} T;
+extern void *foo (const char *, const char *);
+extern void *bar (void *, const char *, T);
+extern int baz (const char *, int);
+
+extern inline __attribute__ ((always_inline, gnu_inline)) int
+baz (const char *x, int y)
+{
+ return 2;
+}
+
+int
+baz (const char *x, int y)
+{
+ return 1;
+}
+
+int xa, xb;
+
+static void *
+inl (const char *x, const char *y)
+{
+ T t = { &xa, &xb };
+ int *f = (int *) __builtin_malloc (sizeof (int));
+ const char *z;
+ int o = 0;
+ void *r = 0;
+
+ for (z = y; *z; z++)
+ {
+ if (*z == 'r')
+ o |= 1;
+ if (*z == 'w')
+ o |= 2;
+ }
+ if (o == 1)
+ *f = baz (x, 0);
+ if (o == 2)
+ *f = baz (x, 1);
+ if (o == 3)
+ *f = baz (x, 2);
+
+ if (o && *f > 0)
+ r = bar (f, "w", t);
+ return r;
+}
+
+void *
+foo (const char *x, const char *y)
+{
+ return inl (x, y);
+}
diff --git a/gcc/testsuite/c-c++-common/pr36513-2.c b/gcc/testsuite/c-c++-common/pr36513-2.c
new file mode 100644
index 000000000..3c12e1ae8
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr36513-2.c
@@ -0,0 +1,13 @@
+/* PR 36513: -Wlogical-op warns about strchr */
+/* { dg-do compile } */
+/* { dg-options "-Wlogical-op" } */
+#ifdef __cplusplus
+#include <cstring>
+#else
+#include <string.h>
+#endif
+int main2 ()
+{
+ char *s, t;
+ strchr (s, t);
+}
diff --git a/gcc/testsuite/c-c++-common/pr36513.c b/gcc/testsuite/c-c++-common/pr36513.c
new file mode 100644
index 000000000..026325410
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr36513.c
@@ -0,0 +1,15 @@
+/* PR 36513: -Wlogical-op warns about strchr */
+/* { dg-do compile } */
+/* { dg-options "-Wlogical-op" } */
+
+extern void *__rawmemchr (const void *__s, int __c);
+int main1 ()
+{
+ char *s, t;
+ (__extension__ (__builtin_constant_p (t)
+ && !__builtin_constant_p (s)
+ && (t) == '\0'
+ ? (char *) __rawmemchr (s, t)
+ : __builtin_strchr (s, t)));
+}
+
diff --git a/gcc/testsuite/c-c++-common/pr41779.c b/gcc/testsuite/c-c++-common/pr41779.c
new file mode 100644
index 000000000..80c8e6b1d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr41779.c
@@ -0,0 +1,56 @@
+/* PR41779: Wconversion cannot see throught real*integer promotions. */
+/* { dg-do compile } */
+/* { dg-skip-if "doubles are floats" { "avr-*-*" } { "*" } { "" } } */
+/* { dg-options "-std=c99 -Wconversion" { target c } } */
+/* { dg-options "-Wconversion" { target c++ } } */
+/* { dg-require-effective-target large_double } */
+
+float f1(float x, unsigned short y)
+{
+ return x * y;
+}
+
+float f2(float x, short y)
+{
+ return x * y;
+}
+
+float f3(float x, char y)
+{
+ return x * y;
+}
+
+float f4(float x, unsigned char y)
+{
+ return x * y;
+}
+
+float f5(float x, int y)
+{
+ return x * y; /* { dg-warning "conversion" } */
+}
+
+double c1(float x, unsigned short y, int z)
+{
+ return z ? x + x : y;
+}
+
+double c2(float x, short y, int z)
+{
+ return z ? x + x : y;
+}
+
+double c3(float x, char y, int z)
+{
+ return z ? x + x : y;
+}
+
+double c4(float x, unsigned char y, int z)
+{
+ return z ? x + x : y;
+}
+
+double c5(float x, int y, int z)
+{
+ return z ? x + x : y; /* { dg-warning "conversion" } */
+}
diff --git a/gcc/testsuite/c-c++-common/pr41935.c b/gcc/testsuite/c-c++-common/pr41935.c
new file mode 100644
index 000000000..3279e7559
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr41935.c
@@ -0,0 +1,70 @@
+/* { dg-options "-Warray-bounds" } */
+/* { dg-do compile } */
+
+struct A
+{
+ int i;
+ char p[1];
+};
+
+struct B
+{
+ struct A a;
+ int i;
+};
+
+struct C
+{
+ int i;
+ struct A a;
+};
+
+union D
+{
+ char p[1];
+ struct A a;
+ struct B b;
+ struct C c;
+};
+
+struct E
+{
+ int i;
+ union D d;
+};
+
+struct F
+{
+ union D d;
+ int i;
+};
+
+union G
+{
+ int i;
+ union D d;
+};
+
+void
+f0 ()
+{
+ __builtin_offsetof (struct A, p[4]); /* OK */
+ __builtin_offsetof (struct B, a.p[4]); /* { dg-warning "greater than size" } */
+ __builtin_offsetof (struct C, a.p[4]); /* OK */
+ __builtin_offsetof (union D, p[4]); /* OK */
+ __builtin_offsetof (union D, a.p[4]); /* OK */
+ __builtin_offsetof (union D, b.a.p[4]); /* { dg-warning "greater than size" } */
+ __builtin_offsetof (union D, c.a.p[4]); /* OK */
+ __builtin_offsetof (struct E, d.p[4]); /* OK */
+ __builtin_offsetof (struct E, d.a.p[4]); /* OK */
+ __builtin_offsetof (struct E, d.b.a.p[4]); /* { dg-warning "greater than size" } */
+ __builtin_offsetof (struct E, d.c.a.p[4]); /* OK */
+ __builtin_offsetof (struct F, d.p[4]); /* { dg-warning "greater than size" } */
+ __builtin_offsetof (struct F, d.a.p[4]); /* { dg-warning "greater than size" } */
+ __builtin_offsetof (struct F, d.b.a.p[4]); /* { dg-warning "greater than size" } */
+ __builtin_offsetof (struct F, d.c.a.p[4]); /* { dg-warning "greater than size" } */
+ __builtin_offsetof (union G, d.p[4]); /* OK */
+ __builtin_offsetof (union G, d.a.p[4]); /* OK */
+ __builtin_offsetof (union G, d.b.a.p[4]); /* { dg-warning "greater than size" } */
+ __builtin_offsetof (union G, d.c.a.p[4]); /* OK */
+}
diff --git a/gcc/testsuite/c-c++-common/pr42674.c b/gcc/testsuite/c-c++-common/pr42674.c
new file mode 100644
index 000000000..ae6730c50
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr42674.c
@@ -0,0 +1,13 @@
+/* PR middle-end/42674 */
+/* { dg-do compile } */
+/* { dg-options "-Wreturn-type" } */
+
+extern void bar (void);
+static int foo (void) __attribute__ ((__noreturn__, __used__));
+
+static int
+foo (void)
+{
+ while (1)
+ bar ();
+}
diff --git a/gcc/testsuite/c-c++-common/pr43690.c b/gcc/testsuite/c-c++-common/pr43690.c
new file mode 100644
index 000000000..67c6cb0f8
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr43690.c
@@ -0,0 +1,13 @@
+/* PR middle-end/43690 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+void
+foo (char *x)
+{
+ asm ("" : : "m" (x++)); /* { dg-error "is not directly addressable" } */
+ asm ("" : : "m" (++x)); /* { dg-error "is not directly addressable" } */
+ asm ("" : : "m" (x--)); /* { dg-error "is not directly addressable" } */
+ asm ("" : : "m" (--x)); /* { dg-error "is not directly addressable" } */
+ asm ("" : : "m" (x + 1)); /* { dg-error "is not directly addressable" } */
+}
diff --git a/gcc/testsuite/c-c++-common/pr43942.c b/gcc/testsuite/c-c++-common/pr43942.c
new file mode 100644
index 000000000..3d97db662
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr43942.c
@@ -0,0 +1,33 @@
+/* PR debug/43942 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fcompare-debug" } */
+
+extern int f1 (int);
+
+int
+f2 (int x)
+{
+ extern int v;
+ return f1 (x);
+}
+
+void
+f3 (void)
+{
+ f2 (0);
+}
+
+static inline int
+f4 (int x)
+{
+ extern int w;
+ if (w)
+ return f1 (x);
+ return 0;
+}
+
+void
+f5 (void)
+{
+ f4 (0);
+}
diff --git a/gcc/testsuite/c-c++-common/pr44832.c b/gcc/testsuite/c-c++-common/pr44832.c
new file mode 100644
index 000000000..ccb2826ee
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr44832.c
@@ -0,0 +1,161 @@
+/* PR debug/44832 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fcompare-debug" } */
+/* { dg-options "-O2 -fcompare-debug -fno-short-enums" {target short_enums} } */
+
+struct rtx_def;
+typedef struct rtx_def *rtx;
+typedef const struct rtx_def *const_rtx;
+struct rtvec_def;
+typedef struct rtvec_def *rtvec;
+extern int ix86_isa_flags;
+
+enum machine_mode
+{
+ VOIDmode,
+ V8HImode,
+ V16QImode,
+ V4SImode,
+ V2DImode,
+ V32QImode,
+ MAX_MACHINE_MODE,
+
+ NUM_MACHINE_MODES = MAX_MACHINE_MODE
+};
+extern unsigned char mode_size[NUM_MACHINE_MODES];
+extern const unsigned char mode_inner[NUM_MACHINE_MODES];
+extern const unsigned char mode_nunits[NUM_MACHINE_MODES];
+enum rtx_code {
+
+CONST_INT ,
+
+CONST_FIXED ,
+
+CONST_DOUBLE
+
+ };
+union rtunion_def
+{
+ rtvec rt_rtvec;
+};
+typedef union rtunion_def rtunion;
+struct rtx_def {
+
+ __extension__ enum rtx_code code: 16;
+
+ __extension__ enum machine_mode mode : 8;
+
+ union u {
+ rtunion fld[1];
+ } u;
+};
+struct rtvec_def {
+ rtx elem[1];
+};
+extern int rtx_equal_p (const_rtx, const_rtx);
+extern rtx gen_reg_rtx (enum machine_mode);
+
+extern void
+ix86_expand_vector_init_concat (enum machine_mode mode,
+ rtx target, rtx *ops, int n);
+
+static void
+ix86_expand_vector_init_general (unsigned char mmx_ok, enum machine_mode mode,
+ rtx target, rtx vals)
+{
+ rtx ops[32], op0, op1;
+ enum machine_mode half_mode = VOIDmode;
+ int n, i;
+
+ switch (mode)
+ {
+ case V4SImode:
+ case V2DImode:
+ n = mode_nunits[mode];
+ ix86_expand_vector_init_concat (mode, target, ops, n);
+ return;
+
+ case V32QImode:
+ goto half;
+half:
+{
+ typedef int eger;
+ if (mode != V4SImode)
+ ops[0] = 0;
+}
+ n = mode_nunits[mode];
+ for (i = 0; i < n; i++)
+ ops[i] = (((((vals)->u.fld[0]).rt_rtvec))->elem[i]);
+ op0 = gen_reg_rtx (VOIDmode);
+ return;
+
+ case V16QImode:
+ if (!((ix86_isa_flags & (1 << 19)) != 0))
+ break;
+
+ case V8HImode:
+ if (!((ix86_isa_flags & (1 << 17)) != 0))
+ break;
+
+ n = mode_nunits[mode];
+ for (i = 0; i < n; i++)
+ ops[i] = (((((vals)->u.fld[0]).rt_rtvec))->elem[i]);
+ return;
+
+ default:
+ ;
+ }
+
+ {
+ int n_words;
+
+ n_words = ((unsigned short) mode_size[mode]) / 4;
+
+ if (n_words == 4)
+ ix86_expand_vector_init_general (0, V4SImode, 0, 0);
+ }
+}
+
+
+void
+ix86_expand_vector_init (unsigned char mmx_ok, rtx target, rtx vals)
+{
+ enum machine_mode mode = ((enum machine_mode) (target)->mode);
+ enum machine_mode inner_mode = ((enum machine_mode) mode_inner[mode]);
+ int n_elts = mode_nunits[mode];
+ int n_var = 0, one_var = -1;
+ unsigned char all_same = 1, all_const_zero = 1;
+ int i;
+ rtx x;
+
+ for (i = 0; i < n_elts; ++i)
+ {
+ x = (((((vals)->u.fld[0]).rt_rtvec))->elem[i]);
+ if (!((((enum rtx_code) (x)->code) == CONST_INT)
+ || ((enum rtx_code) (x)->code) == CONST_DOUBLE
+ || ((enum rtx_code) (x)->code) == CONST_FIXED))
+ n_var++, one_var = i;
+ else
+ all_const_zero = 0;
+ if (i > 0 && !rtx_equal_p (x, (((((vals)->u.fld[0]).rt_rtvec))->elem[0])))
+ all_same = 0;
+ }
+
+
+ if (n_var == 0)
+ {
+ return;
+ }
+
+ if (all_same)
+ return;
+
+ if (n_var == 1)
+ {
+ if (all_const_zero)
+ return;
+
+ }
+
+ ix86_expand_vector_init_general (mmx_ok, mode, target, vals);
+}
diff --git a/gcc/testsuite/c-c++-common/pr51768.c b/gcc/testsuite/c-c++-common/pr51768.c
new file mode 100644
index 000000000..082594cca
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr51768.c
@@ -0,0 +1,25 @@
+/* PR middle-end/51768 */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+void
+foo (void)
+{
+ asm goto ("" : : : : lab, lab, lab2, lab); /* { dg-error "duplicate asm operand name" } */
+lab:;
+lab2:;
+}
+
+void
+bar (void)
+{
+ asm goto ("" : : [lab] "i" (0) : : lab); /* { dg-error "duplicate asm operand name" } */
+lab:;
+}
+
+void
+baz (void)
+{
+ int x;
+ asm ("" : [lab] "=r" (x) : [lab] "r" (x)); /* { dg-error "duplicate asm operand name" } */
+}
diff --git a/gcc/testsuite/c-c++-common/pr52181.c b/gcc/testsuite/c-c++-common/pr52181.c
new file mode 100644
index 000000000..e09bc92fc
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr52181.c
@@ -0,0 +1,13 @@
+/* PR c/52181 */
+/* { dg-do compile } */
+
+extern const int v1[];
+const int __attribute__((aligned(16))) v1[] = { 1 };
+extern const int __attribute__((aligned(16))) v2[];
+const int v2[] = { 1 };
+extern const int __attribute__((aligned(16))) v3[];
+const int __attribute__((aligned(16))) v3[] = { 1 };
+const int __attribute__((aligned(16))) v4[] = { 1 };
+int test[(__alignof__ (v4) != __alignof__ (v1) /* { dg-bogus "is negative" } */
+ || __alignof__ (v4) != __alignof__ (v2)
+ || __alignof__ (v4) != __alignof__ (v3)) ? -1 : 0];
diff --git a/gcc/testsuite/c-c++-common/pr54486.c b/gcc/testsuite/c-c++-common/pr54486.c
new file mode 100644
index 000000000..e8125fcf3
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr54486.c
@@ -0,0 +1,32 @@
+/* PR middle-end/54486 */
+/* { dg-do compile } */
+/* { dg-options "-Wformat" } */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef __SIZE_TYPE__ size_t;
+extern int printf (const char *, ...);
+extern size_t strspn (const char *, const char *);
+extern size_t strcspn (const char *, const char *);
+extern size_t strlen (const char *);
+#ifdef __cplusplus
+}
+#endif
+
+void
+foo (void)
+{
+ printf ("%zu\n", strspn ("abc", "abcdefg"));
+ printf ("%zu\n", (size_t) strspn ("abc", "abcdefg"));
+ printf ("%zu\n", __builtin_strspn ("abc", "abcdefg"));
+ printf ("%zu\n", (size_t) __builtin_strspn ("abc", "abcdefg"));
+ printf ("%zu\n", strcspn ("abc", "abcdefg"));
+ printf ("%zu\n", (size_t) strcspn ("abc", "abcdefg"));
+ printf ("%zu\n", __builtin_strcspn ("abc", "abcdefg"));
+ printf ("%zu\n", (size_t) __builtin_strcspn ("abc", "abcdefg"));
+ printf ("%zu\n", strlen ("abc"));
+ printf ("%zu\n", (size_t) strlen ("abc"));
+ printf ("%zu\n", __builtin_strlen ("abc"));
+ printf ("%zu\n", (size_t) __builtin_strlen ("abc"));
+}
diff --git a/gcc/testsuite/c-c++-common/raw-string-1.c b/gcc/testsuite/c-c++-common/raw-string-1.c
new file mode 100644
index 000000000..199a3c6c8
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/raw-string-1.c
@@ -0,0 +1,141 @@
+// { dg-do run }
+// { dg-require-effective-target wchar }
+// { dg-options "-std=gnu99 -Wno-c++-compat -trigraphs" { target c } }
+// { dg-options "-std=c++0x" { target c++ } }
+
+#ifndef __cplusplus
+#include <wchar.h>
+
+typedef __CHAR16_TYPE__ char16_t;
+typedef __CHAR32_TYPE__ char32_t;
+#endif
+
+const char s0[] = R"(a\
+\u010d\U0000010D\\\'\"\?\a\b\f\n\r\t\v\0\00\000\xa\xabb
+c)";
+const char s1[] = "a\\\n\\u010d\\U0000010D\\\\\\'\\\"\\?\\a\\b\\f\\n\\r\\t\\v\\0\\00\\000\\xa\\xabb\nc";
+const char s2[] = R"*|*(a\
+b
+c)"
+c)*|"
+c)*|*";
+const char s3[] = "a\\\nb\nc)\"\nc)*|\"\nc";
+// The ) in ??) below is part of the raw string suffix )".
+const char s4[] = R"(??/
+??/
+??(??<??=??'??!??-??>??)";
+const char s5[] = "?\?/\n?\?/\n?\?(?\?<?\?=?\?'?\?!?\?-?\?>?\?";
+
+const char t0[] = u8R"(a\
+\u010d\U0000010D\\\'\"\?\a\b\f\n\r\t\v\0\00\000\xa\xabb
+c)";
+const char t1[] = u8"a\\\n\\u010d\\U0000010D\\\\\\'\\\"\\?\\a\\b\\f\\n\\r\\t\\v\\0\\00\\000\\xa\\xabb\nc";
+const char t2[] = u8R"*|*(a\
+b
+c)"
+c)*|"
+c)*|*";
+const char t3[] = u8"a\\\nb\nc)\"\nc)*|\"\nc";
+const char t4[] = u8R"(??/
+??/
+??(??<??=??'??!??-??>??)";
+const char t5[] = u8"?\?/\n?\?/\n?\?(?\?<?\?=?\?'?\?!?\?-?\?>?\?";
+
+const char16_t u0[] = uR"(a\
+\u010d\U0000010D\\\'\"\?\a\b\f\n\r\t\v\0\00\000\xa\xabb
+c)";
+const char16_t u1[] = u"a\\\n\\u010d\\U0000010D\\\\\\'\\\"\\?\\a\\b\\f\\n\\r\\t\\v\\0\\00\\000\\xa\\xabb\nc";
+const char16_t u2[] = uR"*|*(a\
+b
+c)"
+c)*|"
+c)*|*";
+const char16_t u3[] = u"a\\\nb\nc)\"\nc)*|\"\nc";
+const char16_t u4[] = uR"(??/
+??/
+??(??<??=??'??!??-??>??)";
+const char16_t u5[] = u"?\?/\n?\?/\n?\?(?\?<?\?=?\?'?\?!?\?-?\?>?\?";
+
+const char32_t U0[] = UR"(a\
+\u010d\U0000010D\\\'\"\?\a\b\f\n\r\t\v\0\00\000\xa\xabb
+c)";
+const char32_t U1[] = U"a\\\n\\u010d\\U0000010D\\\\\\'\\\"\\?\\a\\b\\f\\n\\r\\t\\v\\0\\00\\000\\xa\\xabb\nc";
+const char32_t U2[] = UR"*|*(a\
+b
+c)"
+c)*|"
+c)*|*";
+const char32_t U3[] = U"a\\\nb\nc)\"\nc)*|\"\nc";
+const char32_t U4[] = UR"(??/
+??/
+??(??<??=??'??!??-??>??)";
+const char32_t U5[] = U"?\?/\n?\?/\n?\?(?\?<?\?=?\?'?\?!?\?-?\?>?\?";
+
+const wchar_t L0[] = LR"(a\
+\u010d\U0000010D\\\'\"\?\a\b\f\n\r\t\v\0\00\000\xa\xabb
+c)";
+const wchar_t L1[] = L"a\\\n\\u010d\\U0000010D\\\\\\'\\\"\\?\\a\\b\\f\\n\\r\\t\\v\\0\\00\\000\\xa\\xabb\nc";
+const wchar_t L2[] = LR"*|*(a\
+b
+c)"
+c)*|"
+c)*|*";
+const wchar_t L3[] = L"a\\\nb\nc)\"\nc)*|\"\nc";
+const wchar_t L4[] = LR"(??/
+??/
+??(??<??=??'??!??-??>??)";
+const wchar_t L5[] = L"?\?/\n?\?/\n?\?(?\?<?\?=?\?'?\?!?\?-?\?>?\?";
+
+int
+main (void)
+{
+ if (sizeof (s0) != sizeof (s1)
+ || __builtin_memcmp (s0, s1, sizeof (s0)) != 0)
+ __builtin_abort ();
+ if (sizeof (s2) != sizeof (s3)
+ || __builtin_memcmp (s2, s3, sizeof (s2)) != 0)
+ __builtin_abort ();
+ if (sizeof (s4) != sizeof (s5)
+ || __builtin_memcmp (s4, s5, sizeof (s4)) != 0)
+ __builtin_abort ();
+ if (sizeof (t0) != sizeof (t1)
+ || __builtin_memcmp (t0, t1, sizeof (t0)) != 0)
+ __builtin_abort ();
+ if (sizeof (t2) != sizeof (t3)
+ || __builtin_memcmp (t2, t3, sizeof (t2)) != 0)
+ __builtin_abort ();
+ if (sizeof (t4) != sizeof (t5)
+ || __builtin_memcmp (t4, t5, sizeof (t4)) != 0)
+ __builtin_abort ();
+ if (sizeof (u0) != sizeof (u1)
+ || __builtin_memcmp (u0, u1, sizeof (u0)) != 0)
+ __builtin_abort ();
+ if (sizeof (u2) != sizeof (u3)
+ || __builtin_memcmp (u2, u3, sizeof (u2)) != 0)
+ __builtin_abort ();
+ if (sizeof (u4) != sizeof (u5)
+ || __builtin_memcmp (u4, u5, sizeof (u4)) != 0)
+ __builtin_abort ();
+ if (sizeof (U0) != sizeof (U1)
+ || __builtin_memcmp (U0, U1, sizeof (U0)) != 0)
+ __builtin_abort ();
+ if (sizeof (U2) != sizeof (U3)
+ || __builtin_memcmp (U2, U3, sizeof (U2)) != 0)
+ __builtin_abort ();
+ if (sizeof (U4) != sizeof (U5)
+ || __builtin_memcmp (U4, U5, sizeof (U4)) != 0)
+ __builtin_abort ();
+ if (sizeof (L0) != sizeof (L1)
+ || __builtin_memcmp (L0, L1, sizeof (L0)) != 0)
+ __builtin_abort ();
+ if (sizeof (L2) != sizeof (L3)
+ || __builtin_memcmp (L2, L3, sizeof (L2)) != 0)
+ __builtin_abort ();
+ if (sizeof (L4) != sizeof (L5)
+ || __builtin_memcmp (L4, L5, sizeof (L4)) != 0)
+ __builtin_abort ();
+ if (sizeof (R"*()*") != 1
+ || __builtin_memcmp (R"*()*", "", 1) != 0)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/raw-string-10.c b/gcc/testsuite/c-c++-common/raw-string-10.c
new file mode 100644
index 000000000..76ed34e60
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/raw-string-10.c
@@ -0,0 +1,20 @@
+// Test that we don't revert trigraphs and line splicing when a raw string
+// literal is formed by token pasting.
+// { dg-options "-std=gnu99 -trigraphs" { target c } }
+// { dg-options "-std=c++0x" { target c++ } }
+// { dg-do run }
+
+#define PASTE(X,Y) X##Y
+
+const char a[] = PASTE(R,"(??>\
+)");
+
+#define TEST(str, val) \
+ if (sizeof (str) != sizeof (val) \
+ || __builtin_memcmp (str, val, sizeof (str)) != 0) \
+ __builtin_abort ()
+
+int main()
+{
+ TEST (a, "}");
+}
diff --git a/gcc/testsuite/c-c++-common/raw-string-11.c b/gcc/testsuite/c-c++-common/raw-string-11.c
new file mode 100644
index 000000000..49ceba225
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/raw-string-11.c
@@ -0,0 +1,13 @@
+// PR preprocessor/48740
+// { dg-options "-std=gnu99 -trigraphs -save-temps" { target c } }
+// { dg-options "-std=c++0x -save-temps" { target c++ } }
+// { dg-do run }
+
+int main ()
+{
+ return __builtin_memcmp (R"raw(foo%sbar%sfred%sbob?????)raw",
+ "foo%sbar%sfred%sbob?""?""?""?""?",
+ sizeof ("foo%sbar%sfred%sbob?""?""?""?""?"));
+}
+
+// { dg-final { cleanup-saved-temps } }
diff --git a/gcc/testsuite/c-c++-common/raw-string-2.c b/gcc/testsuite/c-c++-common/raw-string-2.c
new file mode 100644
index 000000000..e296a0805
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/raw-string-2.c
@@ -0,0 +1,125 @@
+// { dg-do run }
+// { dg-require-effective-target wchar }
+// { dg-options "-std=gnu99 -Wno-c++-compat -trigraphs" { target c } }
+// { dg-options "-std=c++0x" { target c++ } }
+
+#ifndef __cplusplus
+#include <wchar.h>
+
+typedef __CHAR16_TYPE__ char16_t;
+typedef __CHAR32_TYPE__ char32_t;
+#endif
+
+#define R
+#define u
+#define uR
+#define U
+#define UR
+#define u8
+#define u8R
+#define L
+#define LR
+
+const char s00[] = R"(a)" "(b)";
+const char s01[] = "(a)" R"*(b)*";
+const char s02[] = R"(a)" R"(b)";
+const char s03[] = R"-(a)-" u8"(b)";
+const char s04[] = "(a)" u8R"MNOPQRSTUVWXYZ(b)MNOPQRSTUVWXYZ";
+const char s05[] = R"(a)" u8R"wxyzABCDEFGHIJKL(b)wxyzABCDEFGHIJKL";
+const char s06[] = u8R";[(a);[" "(b)";
+const char s07[] = u8"(a)" R"(b)";
+const char s08[] = u8R"(a)" R"_{}#[]<>%:;.?*+-(b)_{}#[]<>%:;.?*+-";
+const char s09[] = u8R"/^&|~!=,"'(a)/^&|~!=,"'" u8"(b)";
+const char s10[] = u8"(a)" u8R"0123456789abcdef(b)0123456789abcdef";
+const char s11[] = u8R"ghijklmnopqrstuv(a)ghijklmnopqrstuv" u8R"w(b)w";
+const char s12[] = R"??=??(??<??>??)??'??!??-\
+(a)#[{}]^|~";
+
+const char16_t u03[] = R"-(a)-" u"(b)";
+const char16_t u04[] = "(a)" uR"MNOPQRSTUVWXYZ(b)MNOPQRSTUVWXYZ";
+const char16_t u05[] = R"(a)" uR"wxyzABCDEFGHIJKL(b)wxyzABCDEFGHIJKL";
+const char16_t u06[] = uR";[(a);[" "(b)";
+const char16_t u07[] = u"(a)" R"(b)";
+const char16_t u08[] = uR"(a)" R"_{}#[]<>%:;.?*+-(b)_{}#[]<>%:;.?*+-";
+const char16_t u09[] = uR"/^&|~!=,"'(a)/^&|~!=,"'" u"(b)";
+const char16_t u10[] = u"(a)" uR"0123456789abcdef(b)0123456789abcdef";
+const char16_t u11[] = uR"ghijklmnopqrstuv(a)ghijklmnopqrstuv" uR"w(b)w";
+const char16_t u12[] = uR"??=??(??<??>??)??'??!??-\
+(a)#[{}]^|~";
+
+const char32_t U03[] = R"-(a)-" U"(b)";
+const char32_t U04[] = "(a)" UR"MNOPQRSTUVWXYZ(b)MNOPQRSTUVWXYZ";
+const char32_t U05[] = R"(a)" UR"wxyzABCDEFGHIJKL(b)wxyzABCDEFGHIJKL";
+const char32_t U06[] = UR";[(a);[" "(b)";
+const char32_t U07[] = U"(a)" R"(b)";
+const char32_t U08[] = UR"(a)" R"_{}#[]<>%:;.?*+-(b)_{}#[]<>%:;.?*+-";
+const char32_t U09[] = UR"/^&|~!=,"'(a)/^&|~!=,"'" U"(b)";
+const char32_t U10[] = U"(a)" UR"0123456789abcdef(b)0123456789abcdef";
+const char32_t U11[] = UR"ghijklmnopqrstuv(a)ghijklmnopqrstuv" UR"w(b)w";
+const char32_t U12[] = UR"??=??(??<??>??)??'??!??-\
+(a)#[{}]^|~";
+
+const wchar_t L03[] = R"-(a)-" L"(b)";
+const wchar_t L04[] = "(a)" LR"MNOPQRSTUVWXYZ(b)MNOPQRSTUVWXYZ";
+const wchar_t L05[] = R"(a)" LR"wxyzABCDEFGHIJKL(b)wxyzABCDEFGHIJKL";
+const wchar_t L06[] = LR";[(a);[" "(b)";
+const wchar_t L07[] = L"(a)" R"(b)";
+const wchar_t L08[] = LR"(a)" R"_{}#[]<>%:;.?*+-(b)_{}#[]<>%:;.?*+-";
+const wchar_t L09[] = LR"/^&|~!=,"'(a)/^&|~!=,"'" L"(b)";
+const wchar_t L10[] = L"(a)" LR"0123456789abcdef(b)0123456789abcdef";
+const wchar_t L11[] = LR"ghijklmnopqrstuv(a)ghijklmnopqrstuv" LR"w(b)w";
+const wchar_t L12[] = LR"??=??(??<??>??)??'??!??-\
+(a)#[{}]^|~";
+
+int
+main (void)
+{
+#define TEST(str, val) \
+ if (sizeof (str) != sizeof (val) \
+ || __builtin_memcmp (str, val, sizeof (str)) != 0) \
+ __builtin_abort ()
+ TEST (s00, "a(b)");
+ TEST (s01, "(a)b");
+ TEST (s02, "ab");
+ TEST (s03, "a(b)");
+ TEST (s04, "(a)b");
+ TEST (s05, "ab");
+ TEST (s06, "a(b)");
+ TEST (s07, "(a)b");
+ TEST (s08, "ab");
+ TEST (s09, "a(b)");
+ TEST (s10, "(a)b");
+ TEST (s11, "ab");
+ TEST (s12, "a");
+ TEST (u03, u"a(b)");
+ TEST (u04, u"(a)b");
+ TEST (u05, u"ab");
+ TEST (u06, u"a(b)");
+ TEST (u07, u"(a)b");
+ TEST (u08, u"ab");
+ TEST (u09, u"a(b)");
+ TEST (u10, u"(a)b");
+ TEST (u11, u"ab");
+ TEST (u12, u"a");
+ TEST (U03, U"a(b)");
+ TEST (U04, U"(a)b");
+ TEST (U05, U"ab");
+ TEST (U06, U"a(b)");
+ TEST (U07, U"(a)b");
+ TEST (U08, U"ab");
+ TEST (U09, U"a(b)");
+ TEST (U10, U"(a)b");
+ TEST (U11, U"ab");
+ TEST (U12, U"a");
+ TEST (L03, L"a(b)");
+ TEST (L04, L"(a)b");
+ TEST (L05, L"ab");
+ TEST (L06, L"a(b)");
+ TEST (L07, L"(a)b");
+ TEST (L08, L"ab");
+ TEST (L09, L"a(b)");
+ TEST (L10, L"(a)b");
+ TEST (L11, L"ab");
+ TEST (L12, L"a");
+ return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/raw-string-3.c b/gcc/testsuite/c-c++-common/raw-string-3.c
new file mode 100644
index 000000000..df9e27555
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/raw-string-3.c
@@ -0,0 +1,59 @@
+// If not c++0x/gnu99, the {,u,u8,U,L}R prefix should be parsed as separate
+// token.
+// { dg-do compile }
+// { dg-options "" { target c } }
+// { dg-options "-std=c++98" { target c++ } }
+
+const void *s0 = R"(a)"; // { dg-error "was not declared|undeclared" }
+ // { dg-error "expected ',' or ';'" "" { target *-*-* } 7 }
+const void *s1 = uR"(a)"; // { dg-error "was not declared|undeclared" }
+ // { dg-error "expected ',' or ';'" "" { target *-*-* } 9 }
+const void *s2 = UR"(a)"; // { dg-error "was not declared|undeclared" }
+ // { dg-error "expected ',' or ';'" "" { target *-*-* } 11 }
+const void *s3 = u8R"(a)"; // { dg-error "was not declared|undeclared" }
+ // { dg-error "expected ',' or ';'" "" { target *-*-* } 13 }
+const void *s4 = LR"(a)"; // { dg-error "was not declared|undeclared" }
+ // { dg-error "expected ',' or ';'" "" { target *-*-* } 15 }
+
+const int i0 = R'a'; // { dg-error "expected ',' or ';'" }
+ // { dg-error "was not declared" "" { target c++ } 18 }
+const int i1 = uR'a'; // { dg-error "expected ',' or ';'" }
+ // { dg-error "was not declared" "" { target c++ } 20 }
+const int i2 = UR'a'; // { dg-error "expected ',' or ';'" }
+ // { dg-error "was not declared" "" { target c++ } 22 }
+const int i3 = u8R'a'; // { dg-error "expected ',' or ';'" }
+ // { dg-error "was not declared" "" { target c++ } 24 }
+const int i4 = LR'a'; // { dg-error "expected ',' or ';'" }
+ // { dg-error "was not declared" "" { target c++ } 26 }
+
+#define R "a"
+#define uR "b"
+#define UR "c"
+#define u8R "d"
+#define LR "e"
+
+const void *s5 = R"(a)";
+const void *s6 = uR"(a)";
+const void *s7 = UR"(a)";
+const void *s8 = u8R"(a)";
+const void *s9 = LR"(a)";
+
+#undef R
+#undef uR
+#undef UR
+#undef u8R
+#undef LR
+
+#define R 1 +
+#define uR 2 +
+#define UR 3 +
+#define u8R 4 +
+#define LR 5 +
+
+const int i5 = R'a';
+const int i6 = uR'a';
+const int i7 = UR'a';
+const int i8 = u8R'a';
+const int i9 = LR'a';
+
+int main () {}
diff --git a/gcc/testsuite/c-c++-common/raw-string-4.c b/gcc/testsuite/c-c++-common/raw-string-4.c
new file mode 100644
index 000000000..626e7f257
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/raw-string-4.c
@@ -0,0 +1,29 @@
+// R is not applicable for character literals.
+// { dg-do compile }
+// { dg-options "-std=gnu99" { target c } }
+// { dg-options "-std=c++0x" { target c++ } }
+
+const int i0 = R'a'; // { dg-error "was not declared|undeclared" }
+ // { dg-error "expected ',' or ';'" "" { target *-*-* } 6 }
+const int i1 = uR'a'; // { dg-error "was not declared|undeclared" }
+ // { dg-error "expected ',' or ';'" "" { target *-*-* } 8 }
+const int i2 = UR'a'; // { dg-error "was not declared|undeclared" }
+ // { dg-error "expected ',' or ';'" "" { target *-*-* } 10 }
+const int i3 = u8R'a'; // { dg-error "was not declared|undeclared" }
+ // { dg-error "expected ',' or ';'" "" { target *-*-* } 12 }
+const int i4 = LR'a'; // { dg-error "was not declared|undeclared" }
+ // { dg-error "expected ',' or ';'" "" { target *-*-* } 14 }
+
+#define R 1 +
+#define uR 2 +
+#define UR 3 +
+#define u8R 4 +
+#define LR 5 +
+
+const int i5 = R'a';
+const int i6 = uR'a';
+const int i7 = UR'a';
+const int i8 = u8R'a';
+const int i9 = LR'a';
+
+int main () {}
diff --git a/gcc/testsuite/c-c++-common/raw-string-5.c b/gcc/testsuite/c-c++-common/raw-string-5.c
new file mode 100644
index 000000000..adcdb75ba
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/raw-string-5.c
@@ -0,0 +1,27 @@
+// { dg-do compile }
+// { dg-options "-std=gnu99" { target c } }
+// { dg-options "-std=c++0x" { target c++ } }
+
+const void *s0 = R"0123456789abcdefg()0123456789abcdefg";
+ // { dg-error "raw string delimiter longer" "" { target *-*-* } 5 }
+ // { dg-error "stray" "" { target *-*-* } 5 }
+const void *s1 = R" () ";
+ // { dg-error "invalid character" "" { target *-*-* } 8 }
+ // { dg-error "stray" "" { target *-*-* } 8 }
+const void *s2 = R" () ";
+ // { dg-error "invalid character" "" { target *-*-* } 11 }
+ // { dg-error "stray" "" { target *-*-* } 11 }
+const void *s3 = R")())";
+ // { dg-error "invalid character" "" { target *-*-* } 14 }
+ // { dg-error "stray" "" { target *-*-* } 14 }
+const void *s4 = R"@()@";
+ // { dg-error "invalid character" "" { target *-*-* } 17 }
+ // { dg-error "stray" "" { target *-*-* } 17 }
+const void *s5 = R"$()$";
+ // { dg-error "invalid character" "" { target *-*-* } 20 }
+ // { dg-error "stray" "" { target *-*-* } 20 }
+const void *s6 = R"\u0040()\u0040";
+ // { dg-error "invalid character" "" { target *-*-* } 23 }
+ // { dg-error "stray" "" { target *-*-* } 23 }
+
+int main () {}
diff --git a/gcc/testsuite/c-c++-common/raw-string-6.c b/gcc/testsuite/c-c++-common/raw-string-6.c
new file mode 100644
index 000000000..a3ae42289
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/raw-string-6.c
@@ -0,0 +1,6 @@
+// { dg-do compile }
+// { dg-options "-std=gnu99" { target c } }
+// { dg-options "-std=c++0x" { target c++ } }
+
+const void *s0 = R"ouch()ouCh"; // { dg-error "at end of input" }
+ // { dg-error "unterminated raw string" "" { target *-*-* } 5 }
diff --git a/gcc/testsuite/c-c++-common/raw-string-7.c b/gcc/testsuite/c-c++-common/raw-string-7.c
new file mode 100644
index 000000000..0c556639c
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/raw-string-7.c
@@ -0,0 +1,24 @@
+// The trailing whitespace after \ and before newline extension
+// breaks full compliance for raw strings.
+// { dg-do run { xfail *-*-* } }
+// { dg-options "-std=gnu99" { target c } }
+// { dg-options "-std=c++0x" { target c++ } }
+
+// Note, there is a single space after \ on the following line.
+const char *s0 = R"(\
+)";
+// { dg-bogus "backslash and newline separated by space" "" { xfail *-*-* } 8 }
+
+// Note, there is a single tab after \ on the following line.
+const char *s1 = R"(\
+)";
+// { dg-bogus "backslash and newline separated by space" "" { xfail *-*-* } 13 }
+
+int
+main (void)
+{
+ if (__builtin_strcmp (s0, "\\ \n") != 0
+ || __builtin_strcmp (s1, "\\\t\n") != 0)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/raw-string-8.c b/gcc/testsuite/c-c++-common/raw-string-8.c
new file mode 100644
index 000000000..685b2ef68
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/raw-string-8.c
@@ -0,0 +1,10 @@
+// Test that we track line numbers properly across newlines
+// both escaped and not in raw strings.
+// { dg-options "-std=gnu99" { target c } }
+// { dg-options "-std=c++0x" { target c++ } }
+
+const char a[] = R"(\
+
+)";
+
+T t; // { dg-error "" }
diff --git a/gcc/testsuite/c-c++-common/raw-string-9.c b/gcc/testsuite/c-c++-common/raw-string-9.c
new file mode 100644
index 000000000..6ba6b1a33
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/raw-string-9.c
@@ -0,0 +1,19 @@
+// Make sure that we properly handle trigraphs in raw strings when
+// trigraphs are disabled, too.
+// { dg-options "-std=gnu99" { target c } }
+// { dg-options "-std=gnu++0x" { target c++ } }
+// { dg-do run }
+
+const char b[] = "??>"; // { dg-message "-trigraphs" }
+const char a[] = R"(??>??)??/
+??)";
+
+#define TEST(str, val) \
+ if (sizeof (str) != sizeof (val) \
+ || __builtin_memcmp (str, val, sizeof (str)) != 0) \
+ __builtin_abort ()
+
+int main()
+{
+ TEST (a, "?\?>?\?)?\?/\n?\?");
+}
diff --git a/gcc/testsuite/c-c++-common/restrict-1.c b/gcc/testsuite/c-c++-common/restrict-1.c
new file mode 100644
index 000000000..08fc10f56
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/restrict-1.c
@@ -0,0 +1,20 @@
+/* { dg-do link } */
+/* { dg-options "-O -fno-strict-aliasing -fdump-tree-optimized" } */
+
+extern void link_error (void);
+
+void bar0 (int * __restrict__ arr1, int * __restrict__ arr2)
+{
+ arr1[0] = 1;
+ arr2[0] = 1;
+ if (arr1[0] != 1)
+ link_error ();
+}
+
+int main()
+{
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-not "link_error" "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/c-c++-common/restrict-2.c b/gcc/testsuite/c-c++-common/restrict-2.c
new file mode 100644
index 000000000..ec824653d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/restrict-2.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fno-strict-aliasing -fdump-tree-lim-details" } */
+
+void foo (float * __restrict__ a, float * __restrict__ b, int n, int j)
+{
+ int i;
+ for(i = 0; i < n; ++i)
+ a[i] = (b[j+50] + b[j-50]) * 0.5f;
+}
+
+/* We should move the RHS of the store out of the loop. */
+
+/* { dg-final { scan-tree-dump-times "Moving statement" 11 "lim1" } } */
+/* { dg-final { cleanup-tree-dump "lim\[1-2\]" } } */
diff --git a/gcc/testsuite/c-c++-common/restrict-4.c b/gcc/testsuite/c-c++-common/restrict-4.c
new file mode 100644
index 000000000..3a36def25
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/restrict-4.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-lim1-details" } */
+
+struct Foo
+{
+ int n;
+ int * __restrict__ p;
+};
+void bar(struct Foo f, int * __restrict__ q)
+{
+ int i;
+ for (i = 0; i < f.n; ++i)
+ {
+ *q += f.p[i];
+ }
+}
+
+/* { dg-final { scan-tree-dump "Executing store motion" "lim1" } } */
+/* { dg-final { cleanup-tree-dump "lim1" } } */
diff --git a/gcc/testsuite/c-c++-common/torture/complex-alias-1.c b/gcc/testsuite/c-c++-common/torture/complex-alias-1.c
new file mode 100644
index 000000000..cdf832d63
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/torture/complex-alias-1.c
@@ -0,0 +1,35 @@
+/* Accesses to complex numbers were sometimes marked as scalar and
+ sometimes as struct accesses. */
+/* { dg-do run } */
+/* { dg-options "-std=c99" { target c } } */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern void abort (void);
+#ifdef __cplusplus
+}
+#endif
+static double _Complex *fp_cxd(double _Complex *cx) {
+ return cx;
+}
+
+int main( ) {
+ double _Complex cx = 4.0 + 3.0*(__extension__ 1.0iF);
+ double _Complex cx43 = 4.0 + 3.0*(__extension__ 1.0iF);
+ double _Complex cx11 = 1.0 + 1.0*(__extension__ 1.0iF);
+
+ *fp_cxd(&cx) *= cx11;
+ *fp_cxd(&cx) /= cx11;
+
+ double r_cx = __real__(cx);
+ double i_cx = __imag__(cx);
+ double r_cx43 = __real__(cx43);
+ double i_cx43 = __imag__(cx43);
+
+ if( (r_cx == r_cx43) && (i_cx == i_cx43) ) {
+ return 0;
+ } else {
+ abort ();
+ }
+}
diff --git a/gcc/testsuite/c-c++-common/torture/complex-sign-add.c b/gcc/testsuite/c-c++-common/torture/complex-sign-add.c
new file mode 100644
index 000000000..bcaf8bba9
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/torture/complex-sign-add.c
@@ -0,0 +1,55 @@
+/* Test complex arithmetic with signed zeros. Pure complex
+ addition. */
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" { target c } } */
+
+#include "complex-sign.h"
+
+#define CHECK_ADD(TYPE, COPY, ZERO, ZEROI) \
+ do { \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, +, +, +, +, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, +, +, +, -, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, +, +, -, +, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, +, +, -, -, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, +, -, +, +, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, +, -, +, -, +, -); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, +, -, -, +, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, +, -, -, -, +, -); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, -, +, +, +, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, -, +, +, -, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, -, +, -, +, -, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, -, +, -, -, -, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, -, -, +, +, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, -, -, +, -, +, -); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, -, -, -, +, -, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, -, -, -, -, -, -); \
+ } while (0)
+
+void
+check_add_float (void)
+{
+#ifndef __SPU__
+ CHECK_ADD (float, __builtin_copysignf, 0.0f, 0.0if);
+#endif
+}
+
+void
+check_add_double (void)
+{
+ CHECK_ADD (double, __builtin_copysign, 0.0, 0.0i);
+}
+
+void
+check_add_long_double (void)
+{
+ CHECK_ADD (long double, __builtin_copysignl, 0.0l, 0.0il);
+}
+
+int
+main (void)
+{
+ check_add_float ();
+ check_add_double ();
+ check_add_long_double ();
+ exit (0);
+}
diff --git a/gcc/testsuite/c-c++-common/torture/complex-sign-mixed-add.c b/gcc/testsuite/c-c++-common/torture/complex-sign-mixed-add.c
new file mode 100644
index 000000000..caea562e8
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/torture/complex-sign-mixed-add.c
@@ -0,0 +1,55 @@
+/* Test complex arithmetic with signed zeros. Mixed real/complex
+ addition. */
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" { target c } } */
+
+#include "complex-sign.h"
+
+#define CHECK_ADD(TYPE, COPY, ZERO, ZEROI) \
+ do { \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, +, +, +, +, +, +); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, +, +, +, -, +, -); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, +, +, -, +, +, +); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, +, +, -, -, +, -); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, +, -, +, +, +, +); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, +, -, +, -, +, -); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, +, -, -, +, -, +); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, +, -, -, -, -, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, +, +, +, +, ZERO, +, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, +, +, +, -, ZERO, +, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, +, +, -, +, ZERO, +, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, +, +, -, -, ZERO, +, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, +, -, +, +, ZERO, +, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, +, -, +, -, ZERO, -, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, +, -, -, +, ZERO, +, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, +, -, -, -, ZERO, -, -); \
+ } while (0)
+
+void
+check_add_float (void)
+{
+#ifndef __SPU__
+ CHECK_ADD (float, __builtin_copysignf, 0.0f, 0.0if);
+#endif
+}
+
+void
+check_add_double (void)
+{
+ CHECK_ADD (double, __builtin_copysign, 0.0, 0.0i);
+}
+
+void
+check_add_long_double (void)
+{
+ CHECK_ADD (long double, __builtin_copysignl, 0.0l, 0.0il);
+}
+
+int
+main (void)
+{
+ check_add_float ();
+ check_add_double ();
+ check_add_long_double ();
+ exit (0);
+}
diff --git a/gcc/testsuite/c-c++-common/torture/complex-sign-mixed-div.c b/gcc/testsuite/c-c++-common/torture/complex-sign-mixed-div.c
new file mode 100644
index 000000000..269d5ec42
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/torture/complex-sign-mixed-div.c
@@ -0,0 +1,47 @@
+/* Test complex arithmetic with signed zeros. Mixed real/complex
+ division. */
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" { target c } } */
+
+#include "complex-sign.h"
+
+#define CHECK_DIV(TYPE, COPY, ZERO, ZEROI, ONE) \
+ do { \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, /, +, +, +, ONE, +, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, /, +, +, -, ONE, -, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, /, +, -, +, ONE, +, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, /, +, -, -, ONE, -, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, /, -, +, +, ONE, -, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, /, -, +, -, ONE, +, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, /, -, -, +, ONE, -, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, /, -, -, -, ONE, +, +); \
+ } while (0)
+
+void
+check_div_float (void)
+{
+#ifndef __SPU__
+ CHECK_DIV (float, __builtin_copysignf, 0.0f, 0.0if, 1.0f);
+#endif
+}
+
+void
+check_div_double (void)
+{
+ CHECK_DIV (double, __builtin_copysign, 0.0, 0.0i, 1.0);
+}
+
+void
+check_div_long_double (void)
+{
+ CHECK_DIV (long double, __builtin_copysignl, 0.0l, 0.0il, 1.0l);
+}
+
+int
+main (void)
+{
+ check_div_float ();
+ check_div_double ();
+ check_div_long_double ();
+ exit (0);
+}
diff --git a/gcc/testsuite/c-c++-common/torture/complex-sign-mixed-mul.c b/gcc/testsuite/c-c++-common/torture/complex-sign-mixed-mul.c
new file mode 100644
index 000000000..e79db6d45
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/torture/complex-sign-mixed-mul.c
@@ -0,0 +1,55 @@
+/* Test complex arithmetic with signed zeros. Mixed real/complex
+ multiplication. */
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" { target c } } */
+
+#include "complex-sign.h"
+
+#define CHECK_MUL(TYPE, COPY, ZERO, ZEROI) \
+ do { \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, *, +, +, +, +, +); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, *, +, +, -, +, -); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, *, +, -, +, -, +); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, *, +, -, -, -, -); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, *, -, +, +, -, -); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, *, -, +, -, -, +); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, *, -, -, +, +, -); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, *, -, -, -, +, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, *, +, +, +, ZERO, +, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, *, +, +, -, ZERO, -, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, *, +, -, +, ZERO, +, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, *, +, -, -, ZERO, -, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, *, -, +, +, ZERO, -, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, *, -, +, -, ZERO, +, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, *, -, -, +, ZERO, -, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, *, -, -, -, ZERO, +, +); \
+ } while (0)
+
+void
+check_mul_float (void)
+{
+#ifndef __SPU__
+ CHECK_MUL (float, __builtin_copysignf, 0.0f, 0.0if);
+#endif
+}
+
+void
+check_mul_double (void)
+{
+ CHECK_MUL (double, __builtin_copysign, 0.0, 0.0i);
+}
+
+void
+check_mul_long_double (void)
+{
+ CHECK_MUL (long double, __builtin_copysignl, 0.0l, 0.0il);
+}
+
+int
+main (void)
+{
+ check_mul_float ();
+ check_mul_double ();
+ check_mul_long_double ();
+ exit (0);
+}
diff --git a/gcc/testsuite/c-c++-common/torture/complex-sign-mixed-sub.c b/gcc/testsuite/c-c++-common/torture/complex-sign-mixed-sub.c
new file mode 100644
index 000000000..d9e083cfd
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/torture/complex-sign-mixed-sub.c
@@ -0,0 +1,55 @@
+/* Test complex arithmetic with signed zeros. Mixed real/complex
+ subtraction. */
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" { target c } } */
+
+#include "complex-sign.h"
+
+#define CHECK_SUB(TYPE, COPY, ZERO, ZEROI) \
+ do { \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, -, +, +, +, +, -); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, -, +, +, -, +, +); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, -, +, -, +, +, -); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, -, +, -, -, +, +); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, -, -, +, +, -, -); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, -, -, +, -, -, +); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, -, -, -, +, +, -); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, -, -, -, -, +, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, -, +, +, +, ZERO, +, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, -, +, +, -, ZERO, +, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, -, +, -, +, ZERO, +, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, -, +, -, -, ZERO, +, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, -, -, +, +, ZERO, -, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, -, -, +, -, ZERO, +, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, -, -, -, +, ZERO, -, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, -, -, -, -, ZERO, +, -); \
+ } while (0)
+
+void
+check_sub_float (void)
+{
+#ifndef __SPU__
+ CHECK_SUB (float, __builtin_copysignf, 0.0f, 0.0if);
+#endif
+}
+
+void
+check_sub_double (void)
+{
+ CHECK_SUB (double, __builtin_copysign, 0.0, 0.0i);
+}
+
+void
+check_sub_long_double (void)
+{
+ CHECK_SUB (long double, __builtin_copysignl, 0.0l, 0.0il);
+}
+
+int
+main (void)
+{
+ check_sub_float ();
+ check_sub_double ();
+ check_sub_long_double ();
+ exit (0);
+}
diff --git a/gcc/testsuite/c-c++-common/torture/complex-sign-mul-minus-one.c b/gcc/testsuite/c-c++-common/torture/complex-sign-mul-minus-one.c
new file mode 100644
index 000000000..d20b5e6c8
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/torture/complex-sign-mul-minus-one.c
@@ -0,0 +1,63 @@
+/* Test complex arithmetic with signed zeros. Pure complex
+ multiplication with -1.0 + 0.0i. */
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" { target c } } */
+
+#include "complex-sign.h"
+
+#define CHECK_MUL_INT(TYPE, COPY, ZERO, ZEROI, ONE, S1, S2, SR, SI) \
+ do { \
+ _Complex TYPE a1, b1, c1; \
+ volatile _Complex TYPE a2, b2, c2; \
+ a1 = ENCODE(ZERO, ZEROI, S1, S2); \
+ CHECK_RES (a1, COPY, S1, S2); \
+ b1 = -ONE + ZEROI; \
+ c1 = a1 * b1; \
+ CHECK_RES (c1, COPY, SR, SI); \
+ c1 = a1 * (-ONE + ZEROI); \
+ CHECK_RES (c1, COPY, SR, SI); \
+ a2 = ENCODE(ZERO, ZEROI, S1, S2); \
+ CHECK_RES (a2, COPY, S1, S2); \
+ b2 = -ONE + ZEROI; \
+ c2 = a2 * b2; \
+ CHECK_RES (c2, COPY, SR, SI); \
+ c2 = a2 * (-ONE + ZEROI); \
+ CHECK_RES (c2, COPY, SR, SI); \
+ } while (0)
+
+#define CHECK_MUL(TYPE, COPY, ZERO, ZEROI, ONE) \
+ do { \
+ CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, +, +, -, +); \
+ CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, +, -, +, +); \
+ CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, -, +, +, -); \
+ CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, -, -, +, +); \
+ } while (0)
+
+void
+check_mul_float (void)
+{
+#ifndef __SPU__
+ CHECK_MUL (float, __builtin_copysignf, 0.0f, 0.0if, 1.0f);
+#endif
+}
+
+void
+check_mul_double (void)
+{
+ CHECK_MUL (double, __builtin_copysign, 0.0, 0.0i, 1.0);
+}
+
+void
+check_mul_long_double (void)
+{
+ CHECK_MUL (long double, __builtin_copysignl, 0.0l, 0.0il, 1.0l);
+}
+
+int
+main (void)
+{
+ check_mul_float ();
+ check_mul_double ();
+ check_mul_long_double ();
+ exit (0);
+}
diff --git a/gcc/testsuite/c-c++-common/torture/complex-sign-mul-one.c b/gcc/testsuite/c-c++-common/torture/complex-sign-mul-one.c
new file mode 100644
index 000000000..ad02a2cd6
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/torture/complex-sign-mul-one.c
@@ -0,0 +1,63 @@
+/* Test complex arithmetic with signed zeros. Pure complex
+ multiplication with 1.0 + 0.0i. */
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" { target c } } */
+
+#include "complex-sign.h"
+
+#define CHECK_MUL_INT(TYPE, COPY, ZERO, ZEROI, ONE, S1, S2, SR, SI) \
+ do { \
+ _Complex TYPE a1, b1, c1; \
+ volatile _Complex TYPE a2, b2, c2; \
+ a1 = ENCODE(ZERO, ZEROI, S1, S2); \
+ CHECK_RES (a1, COPY, S1, S2); \
+ b1 = ONE + ZEROI; \
+ c1 = a1 * b1; \
+ CHECK_RES (c1, COPY, SR, SI); \
+ c1 = a1 * (ONE + ZEROI); \
+ CHECK_RES (c1, COPY, SR, SI); \
+ a2 = ENCODE(ZERO, ZEROI, S1, S2); \
+ CHECK_RES (a2, COPY, S1, S2); \
+ b2 = ONE + ZEROI; \
+ c2 = a2 * b2; \
+ CHECK_RES (c2, COPY, SR, SI); \
+ c2 = a2 * (ONE + ZEROI); \
+ CHECK_RES (c2, COPY, SR, SI); \
+ } while (0)
+
+#define CHECK_MUL(TYPE, COPY, ZERO, ZEROI, ONE) \
+ do { \
+ CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, +, +, +, +); \
+ CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, +, -, +, +); \
+ CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, -, +, -, +); \
+ CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, -, -, +, -); \
+ } while (0)
+
+void
+check_mul_float (void)
+{
+#ifndef __SPU__
+ CHECK_MUL (float, __builtin_copysignf, 0.0f, 0.0if, 1.0f);
+#endif
+}
+
+void
+check_mul_double (void)
+{
+ CHECK_MUL (double, __builtin_copysign, 0.0, 0.0i, 1.0);
+}
+
+void
+check_mul_long_double (void)
+{
+ CHECK_MUL (long double, __builtin_copysignl, 0.0l, 0.0il, 1.0l);
+}
+
+int
+main (void)
+{
+ check_mul_float ();
+ check_mul_double ();
+ check_mul_long_double ();
+ exit (0);
+}
diff --git a/gcc/testsuite/c-c++-common/torture/complex-sign-mul.c b/gcc/testsuite/c-c++-common/torture/complex-sign-mul.c
new file mode 100644
index 000000000..a3274d2ea
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/torture/complex-sign-mul.c
@@ -0,0 +1,55 @@
+/* Test complex arithmetic with signed zeros. Pure complex
+ multiplication. */
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" { target c } } */
+
+#include "complex-sign.h"
+
+#define CHECK_MUL(TYPE, COPY, ZERO, ZEROI) \
+ do { \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, +, +, +, +, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, +, +, +, -, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, +, +, -, +, -, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, +, +, -, -, +, -); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, +, -, +, +, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, +, -, +, -, +, -); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, +, -, -, +, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, +, -, -, -, -, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, -, +, +, +, -, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, -, +, +, -, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, -, +, -, +, +, -); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, -, +, -, -, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, -, -, +, +, +, -); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, -, -, +, -, -, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, -, -, -, +, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, -, -, -, -, +, +); \
+ } while (0)
+
+void
+check_mul_float (void)
+{
+#ifndef __SPU__
+ CHECK_MUL (float, __builtin_copysignf, 0.0f, 0.0if);
+#endif
+}
+
+void
+check_mul_double (void)
+{
+ CHECK_MUL (double, __builtin_copysign, 0.0, 0.0i);
+}
+
+void
+check_mul_long_double (void)
+{
+ CHECK_MUL (long double, __builtin_copysignl, 0.0l, 0.0il);
+}
+
+int
+main (void)
+{
+ check_mul_float ();
+ check_mul_double ();
+ check_mul_long_double ();
+ exit (0);
+}
diff --git a/gcc/testsuite/c-c++-common/torture/complex-sign-sub.c b/gcc/testsuite/c-c++-common/torture/complex-sign-sub.c
new file mode 100644
index 000000000..0a4e3029e
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/torture/complex-sign-sub.c
@@ -0,0 +1,55 @@
+/* Test complex arithmetic with signed zeros. Pure complex
+ subtraction. */
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" { target c } } */
+
+#include "complex-sign.h"
+
+#define CHECK_SUB(TYPE, COPY, ZERO, ZEROI) \
+ do { \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, +, +, +, +, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, +, +, +, -, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, +, +, -, +, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, +, +, -, -, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, +, -, +, +, +, -); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, +, -, +, -, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, +, -, -, +, +, -); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, +, -, -, -, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, -, +, +, +, -, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, -, +, +, -, -, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, -, +, -, +, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, -, +, -, -, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, -, -, +, +, -, -); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, -, -, +, -, -, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, -, -, -, +, +, -); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, -, -, -, -, +, +); \
+ } while (0)
+
+void
+check_sub_float (void)
+{
+#ifndef __SPU__
+ CHECK_SUB (float, __builtin_copysignf, 0.0f, 0.0if);
+#endif
+}
+
+void
+check_sub_double (void)
+{
+ CHECK_SUB (double, __builtin_copysign, 0.0, 0.0i);
+}
+
+void
+check_sub_long_double (void)
+{
+ CHECK_SUB (long double, __builtin_copysignl, 0.0l, 0.0il);
+}
+
+int
+main (void)
+{
+ check_sub_float ();
+ check_sub_double ();
+ check_sub_long_double ();
+ exit (0);
+}
diff --git a/gcc/testsuite/c-c++-common/torture/complex-sign.h b/gcc/testsuite/c-c++-common/torture/complex-sign.h
new file mode 100644
index 000000000..96261101c
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/torture/complex-sign.h
@@ -0,0 +1,80 @@
+/* Common header for complex arithmetic sign tests. */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern void abort (void);
+extern void exit (int);
+#ifdef __cplusplus
+}
+#endif
+
+#define CHECK_RES(VALUE, COPY, SIGN_REAL, SIGN_IMAG) \
+ do { \
+ if ((VALUE) != 0 \
+ || COPY (1.0, __real__ (VALUE)) != SIGN_REAL 1.0 \
+ || COPY (1.0, __imag__ (VALUE)) != SIGN_IMAG 1.0) \
+ abort (); \
+ } while (0)
+
+/* This definition is intended to work with or without imaginary
+ types, as long as mixed real/complex arithmetic is handled
+ correctly. */
+#define ENCODE(ZERO, ZEROI, SA, SB) \
+ (SA 1 == 1 \
+ ? SB 1 == 1 ? ZERO + ZEROI : ZERO - ZEROI \
+ : SB 1 == 1 ? -(ZERO - ZEROI) : -(ZERO + ZEROI))
+
+#define CHECK_ARITH(TYPE, COPY, ZERO, ZEROI, OP, S1, S2, S3, S4, SR, SI) \
+ do { \
+ _Complex TYPE a1, b1, c1; \
+ volatile _Complex TYPE a2, b2, c2; \
+ a1 = ENCODE(ZERO, ZEROI, S1, S2); \
+ CHECK_RES (a1, COPY, S1, S2); \
+ b1 = ENCODE(ZERO, ZEROI, S3, S4); \
+ CHECK_RES (b1, COPY, S3, S4); \
+ c1 = a1 OP b1; \
+ CHECK_RES (c1, COPY, SR, SI); \
+ a2 = ENCODE(ZERO, ZEROI, S1, S2); \
+ CHECK_RES (a2, COPY, S1, S2); \
+ b2 = ENCODE(ZERO, ZEROI, S3, S4); \
+ CHECK_RES (b2, COPY, S3, S4); \
+ c2 = a2 OP b2; \
+ CHECK_RES (c2, COPY, SR, SI); \
+ } while (0)
+
+#define CHECK_ARITH_RC(TYPE, COPY, ZERO, ZEROI, OP, S1, S3, S4, SR, SI) \
+ do { \
+ TYPE a1; \
+ _Complex TYPE b1, c1; \
+ volatile TYPE a2; \
+ volatile _Complex TYPE b2, c2; \
+ a1 = S1 ZERO; \
+ b1 = ENCODE(ZERO, ZEROI, S3, S4); \
+ CHECK_RES (b1, COPY, S3, S4); \
+ c1 = a1 OP b1; \
+ CHECK_RES (c1, COPY, SR, SI); \
+ a2 = S1 ZERO; \
+ b2 = ENCODE(ZERO, ZEROI, S3, S4); \
+ CHECK_RES (b2, COPY, S3, S4); \
+ c2 = a2 OP b2; \
+ CHECK_RES (c2, COPY, SR, SI); \
+ } while (0)
+
+#define CHECK_ARITH_CR(TYPE, COPY, ZERO, ZEROI, OP, S1, S2, S3, V3, SR, SI) \
+ do { \
+ _Complex TYPE a1, c1; \
+ TYPE b1; \
+ volatile _Complex TYPE a2, c2; \
+ volatile TYPE b2; \
+ a1 = ENCODE(ZERO, ZEROI, S1, S2); \
+ CHECK_RES (a1, COPY, S1, S2); \
+ b1 = S3 V3; \
+ c1 = a1 OP b1; \
+ CHECK_RES (c1, COPY, SR, SI); \
+ a2 = ENCODE(ZERO, ZEROI, S1, S2); \
+ CHECK_RES (a2, COPY, S1, S2); \
+ b2 = S3 V3; \
+ c2 = a2 OP b2; \
+ CHECK_RES (c2, COPY, SR, SI); \
+ } while (0)
diff --git a/gcc/testsuite/c-c++-common/torture/pr42834.c b/gcc/testsuite/c-c++-common/torture/pr42834.c
new file mode 100644
index 000000000..a1ba49e46
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/torture/pr42834.c
@@ -0,0 +1,23 @@
+/* { dg-do run } */
+
+void __attribute__((noinline,noclone))
+foo(int *p, float *q) { __asm__ volatile ("" : : : "memory"); }
+
+int main()
+{
+ if (sizeof (int) == sizeof (float))
+ {
+ int i;
+ float f;
+ int *p;
+ /* Prevent i and f from being rewritten into SSA form. */
+ foo (&i, &f);
+ i = 0;
+ f = 1.0;
+ p = (int *)&f;
+ __builtin_memcpy (&i, p, 4);
+ if (*(float *)&i != 1.0)
+ __builtin_abort ();
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/torture/pr46137.c b/gcc/testsuite/c-c++-common/torture/pr46137.c
new file mode 100644
index 000000000..3e44ff6b7
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/torture/pr46137.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+
+struct X { };
+
+static inline void *
+bar (void *dst, void *src)
+{
+ return __builtin___memcpy_chk (dst, src, sizeof (struct X),
+ __builtin_object_size (dst, 0));
+}
+
+struct X
+foo (struct X *x)
+{
+ struct X any;
+ bar (&any, x);
+ return any;
+}
diff --git a/gcc/testsuite/c-c++-common/uninit-17.c b/gcc/testsuite/c-c++-common/uninit-17.c
new file mode 100644
index 000000000..1719ae85f
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/uninit-17.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wuninitialized -fno-ivopts" } */
+
+inline int foo(int x)
+{
+ return x;
+}
+static void bar(int a, int *ptr)
+{
+ do
+ {
+ int b; /* { dg-message "declared" } */
+ if (b < 40) {
+ ptr[0] = b;
+ }
+ b += 1; /* { dg-warning "may be used uninitialized" } */
+ ptr++;
+ }
+ while (--a != 0);
+}
+void foobar(int a, int *ptr)
+{
+ bar(foo(a), ptr);
+}
+
diff --git a/gcc/testsuite/c-c++-common/vla-1.c b/gcc/testsuite/c-c++-common/vla-1.c
new file mode 100644
index 000000000..401c4e055
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/vla-1.c
@@ -0,0 +1,21 @@
+/* Test that changes to a variable are reflected in a VLA later in the
+ expression. */
+/* { dg-options "" } */
+
+#ifdef __cplusplus
+extern "C"
+#endif
+void abort();
+
+int i = 4;
+int f()
+{
+ return i;
+}
+
+int main()
+{
+ if (i+=2, sizeof(*(int(*)[f()])0) != 6*sizeof(int))
+ abort();
+ return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/warn-ommitted-condop.c b/gcc/testsuite/c-c++-common/warn-ommitted-condop.c
new file mode 100644
index 000000000..de92b8f2c
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/warn-ommitted-condop.c
@@ -0,0 +1,29 @@
+/* { dg-options "-Wparentheses" } */
+
+extern void f2 (int);
+
+void bar (int x, int y, int z)
+{
+#define T(op) f2 (x op y ? : 1)
+#define T2(op) f2 (x op y ? 2 : 1)
+
+ T(<); /* { dg-warning "omitted middle operand" } */
+ T(>); /* { dg-warning "omitted middle operand" } */
+ T(<=); /* { dg-warning "omitted middle operand" } */
+ T(>=); /* { dg-warning "omitted middle operand" } */
+ T(==); /* { dg-warning "omitted middle operand" } */
+ T(!=); /* { dg-warning "omitted middle operand" } */
+ T(||); /* { dg-warning "omitted middle operand" } */
+ T(&&); /* { dg-warning "omitted middle operand" } */
+ f2 (!x ? : 1); /* { dg-warning "omitted middle operand" } */
+ T2(<); /* { dg-bogus "omitted middle operand" } */
+ T2(>); /* { dg-bogus "omitted middle operand" } */
+ T2(==); /* { dg-bogus "omitted middle operand" } */
+ T2(||); /* { dg-bogus "omitted middle operand" } */
+ T2(&&); /* { dg-bogus "omitted middle operand" } */
+ T(+); /* { dg-bogus "omitted middle operand" } */
+ T(-); /* { dg-bogus "omitted middle operand" } */
+ T(*); /* { dg-bogus "omitted middle operand" } */
+ T(/); /* { dg-bogus "omitted middle operand" } */
+ T(^); /* { dg-bogus "omitted middle operand" } */
+}