summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/dfp/usual-arith-conv-bad.c
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gcc.dg/dfp/usual-arith-conv-bad.c
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gcc.dg/dfp/usual-arith-conv-bad.c')
-rw-r--r--gcc/testsuite/gcc.dg/dfp/usual-arith-conv-bad.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/dfp/usual-arith-conv-bad.c b/gcc/testsuite/gcc.dg/dfp/usual-arith-conv-bad.c
new file mode 100644
index 000000000..e14c7b20a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/dfp/usual-arith-conv-bad.c
@@ -0,0 +1,49 @@
+/* { dg-do compile } */
+
+/* N1150 5.4: Usual arithmetic conversions.
+ C99 6.3.1.8[1] (New).
+
+ Test arithmetic operators between decimal float types and generic
+ float types, which are not allowed. */
+
+extern _Decimal32 d32a, d32b;
+extern _Decimal64 d64a, d64b;
+extern _Decimal128 d128a, d128b;
+extern float f;
+extern double d;
+extern long double ld;
+
+extern signed int __attribute__ ((vector_size (16))) vi;
+
+extern _Complex float cf;
+extern _Complex double cd;
+extern _Complex long double cld;
+extern _Complex int ci;
+
+void
+foo (void)
+{
+ /* Mixed operations with decimal and generic float operands. */
+ d32a = d32b + f; /* { dg-error "" "error.*mix operands of decimal float" } */
+ d32a = f * d32b; /* { dg-error "" "error.* mix operands of decimal float" } */
+ d32a *= f; /* { dg-error "" "error.* mix operands of decimal float" } */
+ f += d32b; /* { dg-error "" "error.* mix operands of decimal float" } */
+ d64a = d32a + d; /* { dg-error "" "error.* mix operands of decimal float" } */
+ d64a = d * d128a; /* { dg-error "" "error.* mix operands of decimal float" } */
+ d64a -= d; /* { dg-error "" "error.* mix operands of decimal float" } */
+ d128a = ld * d128b; /* { dg-error "" "error.* mix operands of decimal float" } */
+ d128a = d64b + d; /* { dg-error "" "error.* mix operands of decimal float" } */
+ d128a *= f; /* { dg-error "" "error.* mix operands of decimal float" } */
+
+ /* Mixed operations with decimal float and a vector type. */
+ d64a = d64b + vi; /* { dg-error "" "error.* mix operands of decimal float" } */
+ d32a *= vi; /* { dg-error "" "error.* mix operands of decimal float" } */
+ d128a = vi - d128b; /* { dg-error "" "error.* mix operands of decimal float" } */
+
+ /* Mixed operations with decimal float and Complex types. */
+ d32a += ci; /* { dg-error "" "error.* mix operands of decimal float" } */
+ d64a = ci * d32a; /* { dg-error "" "error.* mix operands of decimal float" } */
+ cd = d64a * cd; /* { dg-error "" "error.* mix operands of decimal float" } */
+ d128b = cld * d128b; /* { dg-error "" "error.* mix operands of decimal float" } */
+ d32a = cf * d32b; /* { dg-error "" "error.* mix operands of decimal float" } */
+}