Commit 965ff670 by Janis Johnson Committed by Janis Johnson

func-array.c: Support -DDBG to report individual failures.

	* gcc.dg/dfp/func-array.c: Support -DDBG to report individual failures.
	* gcc.dg/dfp/func-struct.c: Ditto.
	* gcc.dg/dfp/operator-assignment.c: Ditto.
	* gcc.dg/dfp/convert-bfp.c: Ditto.
	* gcc.dg/dfp/convert-int.c: Ditto.
	* gcc.dg/dfp/convert-int-max.c: Ditto.
	* gcc.dg/dfp/func-scalar.c: Ditto.
	* gcc.dg/dfp/cast.c: Ditto.
	* gcc.dg/dfp/func-mixed.c: Support -DDBG to report individual
	failures, and fix a typo in return type of arg1_128.
	* gcc.dg/dfp/convert-dfp.c: Support -DDBG to report individual
	failures, and fix a typo in a constant suffix.
	* gcc.dg/dfp/func-vararg-dfp.c: Return zero at the end.
	* gcc.dg/dfp/convert-complex.c: With -DDBG, abort for failures.

From-SVN: r124953
parent ba2f32a9
2007-05-22 Janis Johnson <janis187@us.ibm.com> 2007-05-22 Janis Johnson <janis187@us.ibm.com>
* gcc.dg/dfp/func-array.c: Support -DDBG to report individual
failures.
* gcc.dg/dfp/func-struct.c: Ditto.
* gcc.dg/dfp/operator-assignment.c: Ditto.
* gcc.dg/dfp/convert-bfp.c: Ditto.
* gcc.dg/dfp/convert-int.c: Ditto.
* gcc.dg/dfp/convert-int-max.c: Ditto.
* gcc.dg/dfp/func-scalar.c: Ditto.
* gcc.dg/dfp/cast.c: Ditto.
* gcc.dg/dfp/func-mixed.c: Support -DDBG to report individual
failures, and fix a typo in return type of arg1_128.
* gcc.dg/dfp/convert-dfp.c: Support -DDBG to report individual
failures, and fix a typo in a constant suffix.
* gcc.dg/dfp/func-vararg-dfp.c: Return zero at the end.
* gcc.dg/dfp/convert-complex.c: With -DDBG, abort for failures.
2007-05-22 Janis Johnson <janis187@us.ibm.com>
Manuel Lopez-Ibanez <manu@gcc.gnu.org> Manuel Lopez-Ibanez <manu@gcc.gnu.org>
* lib/gcc-dg.exp(process_message): New proc. * lib/gcc-dg.exp(process_message): New proc.
...@@ -4,6 +4,14 @@ ...@@ -4,6 +4,14 @@
Test valid casts involving decimal float. */ Test valid casts involving decimal float. */
extern void abort (void); extern void abort (void);
int failcnt;
#ifdef DBG
extern int printf (const char *, ...);
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
_Decimal32 d32; _Decimal32 d32;
_Decimal64 d64; _Decimal64 d64;
...@@ -21,19 +29,19 @@ main (void) ...@@ -21,19 +29,19 @@ main (void)
d128 = 1.2dl; d128 = 1.2dl;
if (d32 != (_Decimal32) d64) if (d32 != (_Decimal32) d64)
abort (); FAILURE
if (d32 != (_Decimal32) d128) if (d32 != (_Decimal32) d128)
abort (); FAILURE
if (d64 != (_Decimal64) d32) if (d64 != (_Decimal64) d32)
abort (); FAILURE
if (d64 != (_Decimal64) d128) if (d64 != (_Decimal64) d128)
abort (); FAILURE
if (d128 != (_Decimal128) d32) if (d128 != (_Decimal128) d32)
abort (); FAILURE
if (d128 != (_Decimal128) d64) if (d128 != (_Decimal128) d64)
abort (); FAILURE
/* Casts between generic and decimal floating point types. Use a /* Casts between generic and decimal floating point types. Use a
value that we can assume can be represented exactly in all value that we can assume can be represented exactly in all
...@@ -45,32 +53,35 @@ main (void) ...@@ -45,32 +53,35 @@ main (void)
/* To generic floating types. */ /* To generic floating types. */
if ((float) d32 != 2.0f) if ((float) d32 != 2.0f)
abort (); FAILURE
if ((double) d32 != 2.0l) if ((double) d32 != 2.0l)
abort (); FAILURE
if ((float) d64 != 2.0f) if ((float) d64 != 2.0f)
abort (); FAILURE
if ((double) d64 != 2.0l) if ((double) d64 != 2.0l)
abort (); FAILURE
if ((float) d128 != 2.0f) if ((float) d128 != 2.0f)
abort (); FAILURE
if ((double) d128 != 2.0l) if ((double) d128 != 2.0l)
abort (); FAILURE
/* float to decimal floating types. */ /* float to decimal floating types. */
if (d32 != (_Decimal32) f) if (d32 != (_Decimal32) f)
abort (); FAILURE
if (d64 != (_Decimal64) f) if (d64 != (_Decimal64) f)
abort (); FAILURE
if (d128 != (_Decimal128) f) if (d128 != (_Decimal128) f)
abort (); FAILURE
/* double to decimal floating types. */ /* double to decimal floating types. */
if (d32 != (_Decimal32) d) if (d32 != (_Decimal32) d)
abort (); FAILURE
if (d64 != (_Decimal64) d) if (d64 != (_Decimal64) d)
abort (); FAILURE
if (d128 != (_Decimal128) d) if (d128 != (_Decimal128) d)
FAILURE
if (failcnt != 0)
abort (); abort ();
return 0; return 0;
......
...@@ -7,6 +7,18 @@ ...@@ -7,6 +7,18 @@
/* Long double isn't supported yet at runtime, so disable those checks. */ /* Long double isn't supported yet at runtime, so disable those checks. */
#define SKIP_LONG_DOUBLE #define SKIP_LONG_DOUBLE
extern void abort (void);
static int failcnt;
/* Support compiling the test to report individual failures; default is
to abort as soon as a check fails. */
#ifdef DBG
#include <stdio.h>
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
volatile _Decimal32 d32; volatile _Decimal32 d32;
volatile _Decimal64 d64; volatile _Decimal64 d64;
volatile _Decimal128 d128; volatile _Decimal128 d128;
...@@ -16,8 +28,6 @@ volatile double df; ...@@ -16,8 +28,6 @@ volatile double df;
volatile long double tf; volatile long double tf;
#endif #endif
extern void abort (void);
int int
main () main ()
{ {
...@@ -27,101 +37,104 @@ main () ...@@ -27,101 +37,104 @@ main ()
d32 = 2.0df; d32 = 2.0df;
sf = d32; sf = d32;
if (sf != 2.0f) if (sf != 2.0f)
abort (); FAILURE
df = d32; df = d32;
if (df != 2.0) if (df != 2.0)
abort (); FAILURE
#ifndef SKIP_LONG_DOUBLE #ifndef SKIP_LONG_DOUBLE
tf = d32; tf = d32;
if (tf != 2.0l) if (tf != 2.0l)
abort (); FAILURE
#endif #endif
/* Conversions from _Decimal64. */ /* Conversions from _Decimal64. */
d64 = -7.0dd; d64 = -7.0dd;
sf = d64; sf = d64;
if (sf != -7.0f) if (sf != -7.0f)
abort (); FAILURE
df = d64; df = d64;
if (df != -7.0) if (df != -7.0)
abort (); FAILURE
#ifndef SKIP_LONG_DOUBLE #ifndef SKIP_LONG_DOUBLE
tf = d64; tf = d64;
if (tf != -7.0l) if (tf != -7.0l)
abort (); FAILURE
#endif #endif
/* Conversions from _Decimal128. */ /* Conversions from _Decimal128. */
d128 = 30.0dl; d128 = 30.0dl;
sf = d128; sf = d128;
if (sf != 30.0f) if (sf != 30.0f)
abort (); FAILURE
df = d128; df = d128;
if (df != 30.0) if (df != 30.0)
abort (); FAILURE
df = d128; df = d128;
if (df != 30.0l) if (df != 30.0l)
abort (); FAILURE
/* Conversions from binary float to decimal float. */ /* Conversions from binary float to decimal float. */
sf = 30.0f; sf = 30.0f;
d32 = sf; d32 = sf;
if (d32 != 30.0df) if (d32 != 30.0df)
abort (); FAILURE
d64 = sf; d64 = sf;
if (d64 != 30.0dd) if (d64 != 30.0dd)
abort (); FAILURE
df = -2.0; df = -2.0;
d32 = df; d32 = df;
if (d32 != -2.0df) if (d32 != -2.0df)
abort (); FAILURE
d64 = df; d64 = df;
if (d64 != -2.0dd) if (d64 != -2.0dd)
abort (); FAILURE
d128 = df; d128 = df;
if (d128 != -2.0dl) if (d128 != -2.0dl)
abort (); FAILURE
sf = 30.0f; sf = 30.0f;
d128 = sf; d128 = sf;
if (d128 != 30.0dl) if (d128 != 30.0dl)
abort (); FAILURE
#ifndef SKIP_LONG_DOUBLE #ifndef SKIP_LONG_DOUBLE
tf = -22.0l; tf = -22.0l;
d32 = tf; d32 = tf;
if (d32 != -22.0df) if (d32 != -22.0df)
abort (); FAILURE
d64 = tf; d64 = tf;
if (d64 != -22.0dd) if (d64 != -22.0dd)
abort (); FAILURE
d128 = tf; d128 = tf;
if (d128 != -22.0dl) if (d128 != -22.0dl)
abort (); FAILURE
#endif #endif
/* 2**(-11) = 0.00048828125. */ /* 2**(-11) = 0.00048828125. */
d128 = 0.000488281251dl; d128 = 0.000488281251dl;
sf = d128; sf = d128;
if (sf != 0.00048828125f) if (sf != 0.00048828125f)
abort (); FAILURE
/* 2**(-25) = 0.298023223876953125E-7. */ /* 2**(-25) = 0.298023223876953125E-7. */
d128 = 2.98023223876953125E-8dl; d128 = 2.98023223876953125E-8dl;
df = d128; df = d128;
if (df < (2.9802322387695312e-08 - 0.00000000001) if (df < (2.9802322387695312e-08 - 0.00000000001)
|| df > (2.9802322387695312e-08 + 0.00000000001)) || df > (2.9802322387695312e-08 + 0.00000000001))
FAILURE
if (failcnt != 0)
abort (); abort ();
return 0; return 0;
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
extern void abort(void); extern void abort(void);
static int failcnt; static int failcnt;
/* Support compiling the test to report individual failures; default is /* Support compiling the test to report individual failures; default is
to abort as soon as a check fails. */ to abort as soon as a check fails. */
#ifdef DBG #ifdef DBG
...@@ -124,5 +124,8 @@ main () ...@@ -124,5 +124,8 @@ main ()
if (d128 != 0.0625DL) if (d128 != 0.0625DL)
FAILURE FAILURE
if (failcnt != 0)
abort ();
return 0; return 0;
} }
...@@ -13,6 +13,16 @@ ...@@ -13,6 +13,16 @@
#include <float.h> #include <float.h>
extern void abort (void); extern void abort (void);
static int failcnt;
/* Support compiling the test to report individual failures; default is
to abort as soon as a check fails. */
#ifdef DBG
#include <stdio.h>
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
volatile _Decimal32 d32; volatile _Decimal32 d32;
volatile _Decimal64 d64; volatile _Decimal64 d64;
...@@ -25,29 +35,29 @@ main () ...@@ -25,29 +35,29 @@ main ()
d32 = 123.4df; d32 = 123.4df;
d64 = d32; d64 = d32;
if (d64 != 123.4dd) if (d64 != 123.4dd)
abort (); FAILURE
d128 = d32; d128 = d32;
if (d128 != 123.4dl) if (d128 != 123.4dl)
abort (); FAILURE
d64 = 345.678dd; d64 = 345.678dd;
d128 = d64; d128 = d64;
if (d128 != 345.678dl) if (d128 != 345.678dl)
abort (); FAILURE
/* Conversions to smaller types for which the value fits. */ /* Conversions to smaller types for which the value fits. */
d64 = 3456.789dd; d64 = 3456.789dd;
d32 = d64; d32 = d64;
if (d32 != 3456.789df) if (d32 != 3456.789df)
abort (); FAILURE
d128 = 123.4567dl; d128 = 123.4567dl;
d32 = d128; d32 = d128;
if (d32 != 123.4567dl) if (d32 != 123.4567df)
abort (); FAILURE
d128 = 1234567890.123456dl; d128 = 1234567890.123456dl;
d64 = d128; d64 = d128;
if (d64 != 1234567890.123456dd) if (d64 != 1234567890.123456dd)
abort (); FAILURE
/* Test demotion to non-representable decimal floating type. */ /* Test demotion to non-representable decimal floating type. */
...@@ -59,37 +69,40 @@ main () ...@@ -59,37 +69,40 @@ main ()
d64 = 9.99999949E96DD; d64 = 9.99999949E96DD;
d32 = d64; d32 = d64;
if (d32 != DEC32_MAX) if (d32 != DEC32_MAX)
abort(); FAILURE
/* Rounds to more than _Decimal32 can handle. */ /* Rounds to more than _Decimal32 can handle. */
d64 = 9.9999995E96DD; d64 = 9.9999995E96DD;
d32 = d64; d32 = d64;
if (d32 != __builtin_infd32()) if (d32 != __builtin_infd32())
abort(); FAILURE
/* Rounds to what _Decimal32 can handle. */ /* Rounds to what _Decimal32 can handle. */
d128 = 9.99999949E96DD; d128 = 9.99999949E96DD;
d32 = d128; d32 = d128;
if (d32 != DEC32_MAX) if (d32 != DEC32_MAX)
abort(); FAILURE
/* Rounds to more than _Decimal32 can handle. */ /* Rounds to more than _Decimal32 can handle. */
d128= 9.9999995E96DD; d128= 9.9999995E96DD;
d32 = d128; d32 = d128;
if (d32 != __builtin_infd32()) if (d32 != __builtin_infd32())
abort(); FAILURE
/* Rounds to what _Decimal64 can handle. */ /* Rounds to what _Decimal64 can handle. */
d128 = 9.99999999999999949E384DL; d128 = 9.99999999999999949E384DL;
d64 = d128; d64 = d128;
if (d64 != DEC64_MAX) if (d64 != DEC64_MAX)
abort(); FAILURE
/* Rounds to more than _Decimal64 can handle. */ /* Rounds to more than _Decimal64 can handle. */
d128 = 9.9999999999999995E384DL; d128 = 9.9999999999999995E384DL;
d64 = d128; d64 = d128;
if (d64 != __builtin_infd64()) if (d64 != __builtin_infd64())
abort(); FAILURE
if (failcnt != 0)
abort ();
return 0; return 0;
} }
...@@ -7,6 +7,14 @@ ...@@ -7,6 +7,14 @@
64-bit long long (there's a check for that below). */ 64-bit long long (there's a check for that below). */
extern void abort (void); extern void abort (void);
int failcnt;
#ifdef DBG
extern int printf (const char *, ...);
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
volatile _Decimal32 d32; volatile _Decimal32 d32;
volatile _Decimal64 d64; volatile _Decimal64 d64;
...@@ -24,112 +32,112 @@ doit () ...@@ -24,112 +32,112 @@ doit ()
d32 = 2147483.E3DF; d32 = 2147483.E3DF;
si = d32; si = d32;
if (si != 2147483000) if (si != 2147483000)
abort (); FAILURE
d32 = -2147483.E3DF; d32 = -2147483.E3DF;
si = d32; si = d32;
if (si != -2147483000) if (si != -2147483000)
abort (); FAILURE
/* _Decimal32 to unsigned int. */ /* _Decimal32 to unsigned int. */
d32 = 4.294967E9DF; d32 = 4.294967E9DF;
ui = d32; ui = d32;
if (ui != 4294967000U) if (ui != 4294967000U)
abort (); FAILURE
/* _Decimal32 to long long. */ /* _Decimal32 to long long. */
d32 = 922.3372E16DF; d32 = 922.3372E16DF;
sll = d32; sll = d32;
if (sll != 9223372000000000000LL) if (sll != 9223372000000000000LL)
abort (); FAILURE
d32 = -92233.72E14DF; d32 = -92233.72E14DF;
sll = d32; sll = d32;
if (sll != -9223372000000000000LL) if (sll != -9223372000000000000LL)
abort (); FAILURE
/* _Decimal32 to unsigned long long. */ /* _Decimal32 to unsigned long long. */
d32 = 0.1844674E20DF; d32 = .1844674E20DF;
ull = d32; ull = d32;
if (ull != 18446740000000000000ULL) if (ull != 18446740000000000000ULL)
abort (); FAILURE
/* _Decimal64 to int. */ /* _Decimal64 to int. */
d64 = 2.147483647E9DD; d64 = 2.147483647E9DD;
si = d64; si = d64;
if (si != 2147483647) if (si != 2147483647)
abort (); FAILURE
d64 = -2147483648.DD; d64 = -2147483648.DD;
si = d64; si = d64;
if (si != -2147483648) if (si != -2147483648)
abort (); FAILURE
/* _Decimal64 to unsigned int. */ /* _Decimal64 to unsigned int. */
d64 = 42949.67295E5DD; d64 = 42949.67295E5DD;
ui = d64; ui = d64;
if (ui != 4294967295) if (ui != 4294967295)
abort (); FAILURE
/* _Decimal64 to long long. */ /* _Decimal64 to long long. */
d64 = 9.223372036854775E18DD; d64 = 9.223372036854775E18DD;
sll = d64; sll = d64;
if (sll != 9223372036854775000LL) if (sll != 9223372036854775000LL)
abort (); FAILURE
d64 = -92233720.36854775E11DD; d64 = -92233720.36854775E11DD;
sll = d64; sll = d64;
if (sll != -9223372036854775000LL) if (sll != -9223372036854775000LL)
abort (); FAILURE
/* _Decimal64 to unsigned long long. */ /* _Decimal64 to unsigned long long. */
d64 = 1844674407370955.E4DD; d64 = 1844674407370955.E4DD;
ull = d64; ull = d64;
if (ull != 18446744073709550000ULL) if (ull != 18446744073709550000ULL)
abort (); FAILURE
/* _Decimal128 to int. */ /* _Decimal128 to int. */
d128 = 2.147483647E9DL; d128 = 2.147483647E9DL;
si = d128; si = d128;
if (si != 2147483647) if (si != 2147483647)
abort (); FAILURE
d128 = -2147483648.DL; d128 = -2147483648.DL;
si = d128; si = d128;
if (si != -2147483648) if (si != -2147483648)
abort (); FAILURE
/* _Decimal128 to unsigned int. */ /* _Decimal128 to unsigned int. */
d128 = 4294.967295E6DL; d128 = 4294.967295E6DL;
ui = d128; ui = d128;
if (ui != 4294967295) if (ui != 4294967295)
abort (); FAILURE
/* _Decimal128 to long long. */ /* _Decimal128 to long long. */
d128 = 9223372036854775807.DL; d128 = 9223372036854775807.DL;
sll = d128; sll = d128;
if (sll != 9223372036854775807LL) if (sll != 9223372036854775807LL)
abort (); FAILURE
d128 = -9.223372036854775808E19DL; d128 = -9.223372036854775808E19DL;
sll = d128; sll = d128;
if (sll != -9223372036854775807LL - 1LL) if (sll != -9223372036854775807LL - 1LL)
abort (); FAILURE
/* _Decimal128 to unsigned long long. */ /* _Decimal128 to unsigned long long. */
d128 = 18446744073709551615.DL; d128 = 18446744073709551615.DL;
ull = d128; ull = d128;
if (ull != 18446744073709551615ULL) if (ull != 18446744073709551615ULL)
abort (); FAILURE
} }
int int
...@@ -141,5 +149,8 @@ main () ...@@ -141,5 +149,8 @@ main ()
return 0; return 0;
doit (); doit ();
if (failcnt != 0)
abort ();
return 0; return 0;
} }
...@@ -4,6 +4,14 @@ ...@@ -4,6 +4,14 @@
C99 6.3.1.4(1a) New. */ C99 6.3.1.4(1a) New. */
extern void abort (void); extern void abort (void);
int failcnt;
#ifdef DBG
extern int printf (const char *, ...);
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
_Decimal32 d32; _Decimal32 d32;
_Decimal64 d64; _Decimal64 d64;
...@@ -67,33 +75,33 @@ main () ...@@ -67,33 +75,33 @@ main ()
ui = d32; ui = d32;
if (ui != 456U) if (ui != 456U)
abort (); FAILURE
ul = d32; ul = d32;
if (ul != 456UL) if (ul != 456UL)
abort (); FAILURE
ull = d32; ull = d32;
if (ull != 456ULL) if (ull != 456ULL)
abort (); FAILURE
ui = d64; ui = d64;
if (ui != 23U) if (ui != 23U)
abort (); FAILURE
ul = d64; ul = d64;
if (ul != 23UL) if (ul != 23UL)
abort (); FAILURE
ull = d64; ull = d64;
if (ull != 23ULL) if (ull != 23ULL)
abort (); FAILURE
ui = d128; ui = d128;
if (ui != 1234U) if (ui != 1234U)
abort (); FAILURE
ul = d128; ul = d128;
if (ul != 1234UL) if (ul != 1234UL)
abort (); FAILURE
ull = d128; ull = d128;
if (ull != 1234ULL) if (ull != 1234ULL)
abort (); FAILURE
/* Decimal float to signed integer. */ /* Decimal float to signed integer. */
...@@ -102,91 +110,94 @@ main () ...@@ -102,91 +110,94 @@ main ()
b = d32; b = d32;
if (!b) if (!b)
abort (); FAILURE
b = d64; b = d64;
if (!b) if (!b)
abort (); FAILURE
b = d128; b = d128;
if (!b) if (!b)
abort (); FAILURE
/* Unsigned integer to decimal float. */ /* Unsigned integer to decimal float. */
init_unsigned_int (); init_unsigned_int ();
d32 = ui; d32 = ui;
if (d32 != 987.0df) if (d32 != 987.0df)
abort (); FAILURE
d32 = ul; d32 = ul;
if (d32 != 345678.0df) if (d32 != 345678.0df)
abort (); FAILURE
d32 = ull; d32 = ull;
if (d32 != 1234567.df) if (d32 != 1234567.df)
abort (); FAILURE
d64 = ui; d64 = ui;
if (d64 != 987.0dd) if (d64 != 987.0dd)
abort (); FAILURE
d64 = ul; d64 = ul;
if (d64 != 345678.0dd) if (d64 != 345678.0dd)
abort (); FAILURE
d64 = ull; d64 = ull;
if (d64 != 1234567.dd) if (d64 != 1234567.dd)
abort (); FAILURE
d128 = ui; d128 = ui;
if (d128 != 987.0dl) if (d128 != 987.0dl)
abort (); FAILURE
d128 = ul; d128 = ul;
if (d128 != 345678.0dl) if (d128 != 345678.0dl)
abort (); FAILURE
d128 = ull; d128 = ull;
if (d128 != 1234567.dl) if (d128 != 1234567.dl)
abort (); FAILURE
/* Signed integer to decimal float. */ /* Signed integer to decimal float. */
init_signed_int (); init_signed_int ();
d32 = si; d32 = si;
if (d32 != -987.0df) if (d32 != -987.0df)
abort (); FAILURE
d32 = sl; d32 = sl;
if (d32 != -345678.0df) if (d32 != -345678.0df)
abort (); FAILURE
d32 = sll; d32 = sll;
if (d32 != -1234567.df) if (d32 != -1234567.df)
abort (); FAILURE
d64 = si; d64 = si;
if (d64 != -987.0dd) if (d64 != -987.0dd)
abort (); FAILURE
d64 = sl; d64 = sl;
if (d64 != -345678.0dd) if (d64 != -345678.0dd)
abort (); FAILURE
d64 = sll; d64 = sll;
if (d64 != -1234567.dd) if (d64 != -1234567.dd)
abort (); FAILURE
d128 = si; d128 = si;
if (d128 != -987.0dl) if (d128 != -987.0dl)
abort (); FAILURE
d128 = sl; d128 = sl;
if (d128 != -345678.0dl) if (d128 != -345678.0dl)
abort (); FAILURE
d128 = sll; d128 = sll;
if (d128 != -1234567.dl) if (d128 != -1234567.dl)
abort (); FAILURE
/* _Bool to decimal float. */ /* _Bool to decimal float. */
init_dfp_3 (); init_dfp_3 ();
b = d32; b = d32;
if (b) if (b)
abort (); FAILURE
b = d64; b = d64;
if (b) if (b)
abort (); FAILURE
b = d128; b = d128;
if (b) if (b)
FAILURE
if (failcnt != 0)
abort (); abort ();
return 0; return 0;
......
...@@ -4,6 +4,16 @@ ...@@ -4,6 +4,16 @@
Test passing array elements involving decimal floating point types. */ Test passing array elements involving decimal floating point types. */
extern void abort (void); extern void abort (void);
static int failcnt;
/* Support compiling the test to report individual failures; default is
to abort as soon as a check fails. */
#ifdef DBG
#include <stdio.h>
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
/* A handful of functions that return the Nth _Decimal32 argument of /* A handful of functions that return the Nth _Decimal32 argument of
an incoming array. */ an incoming array. */
...@@ -132,28 +142,31 @@ int main() ...@@ -132,28 +142,31 @@ int main()
_Decimal128 d128[] = { 0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl }; _Decimal128 d128[] = { 0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl };
/* _Decimal32 variants. */ /* _Decimal32 variants. */
if (arg0_32 (d32) != 0.0df) abort (); if (arg0_32 (d32) != 0.0df) FAILURE
if (arg1_32 (d32) != 1.0df) abort (); if (arg1_32 (d32) != 1.0df) FAILURE
if (arg2_32 (d32) != 2.0df) abort (); if (arg2_32 (d32) != 2.0df) FAILURE
if (arg3_32 (d32) != 3.0df) abort (); if (arg3_32 (d32) != 3.0df) FAILURE
if (arg4_32 (d32) != 4.0df) abort (); if (arg4_32 (d32) != 4.0df) FAILURE
if (arg5_32 (d32) != 5.0df) abort (); if (arg5_32 (d32) != 5.0df) FAILURE
/* _Decimal64 variants. */ /* _Decimal64 variants. */
if (arg0_64 (d64) != 0.0dd) abort (); if (arg0_64 (d64) != 0.0dd) FAILURE
if (arg1_64 (d64) != 1.0dd) abort (); if (arg1_64 (d64) != 1.0dd) FAILURE
if (arg2_64 (d64) != 2.0dd) abort (); if (arg2_64 (d64) != 2.0dd) FAILURE
if (arg3_64 (d64) != 3.0dd) abort (); if (arg3_64 (d64) != 3.0dd) FAILURE
if (arg4_64 (d64) != 4.0dd) abort (); if (arg4_64 (d64) != 4.0dd) FAILURE
if (arg5_64 (d64) != 5.0dd) abort (); if (arg5_64 (d64) != 5.0dd) FAILURE
/* _Decimal128 variants. */ /* _Decimal128 variants. */
if (arg0_128 (d128) != 0.0dl) abort (); if (arg0_128 (d128) != 0.0dl) FAILURE
if (arg1_128 (d128) != 1.0dl) abort (); if (arg1_128 (d128) != 1.0dl) FAILURE
if (arg2_128 (d128) != 2.0dl) abort (); if (arg2_128 (d128) != 2.0dl) FAILURE
if (arg3_128 (d128) != 3.0dl) abort (); if (arg3_128 (d128) != 3.0dl) FAILURE
if (arg4_128 (d128) != 4.0dl) abort (); if (arg4_128 (d128) != 4.0dl) FAILURE
if (arg5_128 (d128) != 5.0dl) abort (); if (arg5_128 (d128) != 5.0dl) FAILURE
if (failcnt != 0)
abort ();
return 0; return 0;
} }
...@@ -5,6 +5,16 @@ ...@@ -5,6 +5,16 @@
point types. */ point types. */
extern void abort (void); extern void abort (void);
static int failcnt;
/* Support compiling the test to report individual failures; default is
to abort as soon as a check fails. */
#ifdef DBG
#include <stdio.h>
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
/* A handful of functions that return their Nth _Decimal32 /* A handful of functions that return their Nth _Decimal32
argument with mixed types in parameter list. */ argument with mixed types in parameter list. */
...@@ -106,7 +116,7 @@ arg0_128 (_Decimal128 arg0, int arg1, unsigned int arg2, ...@@ -106,7 +116,7 @@ arg0_128 (_Decimal128 arg0, int arg1, unsigned int arg2,
{ {
return arg0; return arg0;
} }
_Decimal32 _Decimal128
arg1_128 (int arg0, _Decimal128 arg1, unsigned int arg2, arg1_128 (int arg0, _Decimal128 arg1, unsigned int arg2,
float arg3, double arg4, long double arg5) float arg3, double arg4, long double arg5)
{ {
...@@ -147,28 +157,31 @@ int ...@@ -147,28 +157,31 @@ int
main () main ()
{ {
/* _Decimal32 variants. */ /* _Decimal32 variants. */
if (arg0_32 (0.0df, -1, 2, 3.0f, 4.0, 5.0l) != 0.0df) abort (); 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) abort (); 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) abort (); 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) abort (); 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) abort (); 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) abort (); if (arg5_32 (0, -1, 2.0f, 3.0, 4.0l, 5.0df) != 5.0df) FAILURE
/* _Decimal64 variants. */ /* _Decimal64 variants. */
if (arg0_64 (0.0dd, -1, 2, 3.0f, 4.0, 5.0l) != 0.0dd) abort (); 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) abort (); 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) abort (); 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) abort (); 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) abort (); 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) abort (); if (arg5_64 (0, -1, 2.0f, 3.0, 4.0l, 5.0dd) != 5.0dd) FAILURE
/* _Decimal128 variants. */ /* _Decimal128 variants. */
if (arg0_128 (0.0dl, -1, 2, 3.0f, 4.0, 5.0l) != 0.0dl) abort (); 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) abort (); 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) abort (); 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) abort (); 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) abort (); 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) abort (); if (arg5_128 (0, -1, 2.0f, 3.0, 4.0l, 5.0dl) != 5.0dl) FAILURE
if (failcnt != 0)
abort ();
return 0; return 0;
} }
...@@ -5,6 +5,16 @@ ...@@ -5,6 +5,16 @@
point types. */ point types. */
extern void abort (void); extern void abort (void);
static int failcnt;
/* Support compiling the test to report individual failures; default is
to abort as soon as a check fails. */
#ifdef DBG
#include <stdio.h>
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
/* A handful of functions that return their Nth _Decimal32 /* A handful of functions that return their Nth _Decimal32
argument. */ argument. */
...@@ -150,44 +160,47 @@ main () ...@@ -150,44 +160,47 @@ main ()
{ {
/* _Decimal32 variants. */ /* _Decimal32 variants. */
if (arg0_32 (0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 0.0df) if (arg0_32 (0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 0.0df)
abort (); FAILURE
if (arg1_32 (0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 1.0df) if (arg1_32 (0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 1.0df)
abort (); FAILURE
if (arg2_32 (0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 2.0df) if (arg2_32 (0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 2.0df)
abort (); FAILURE
if (arg3_32 (0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 3.0df) if (arg3_32 (0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 3.0df)
abort (); FAILURE
if (arg4_32 (0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 4.0df) if (arg4_32 (0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 4.0df)
abort (); FAILURE
if (arg5_32 (0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 5.0df) if (arg5_32 (0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 5.0df)
abort (); FAILURE
/* _Decimal64 variants. */ /* _Decimal64 variants. */
if (arg0_64 (0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 0.0dd) if (arg0_64 (0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 0.0dd)
abort (); FAILURE
if (arg1_64 (0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 1.0dd) if (arg1_64 (0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 1.0dd)
abort (); FAILURE
if (arg2_64 (0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 2.0dd) if (arg2_64 (0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 2.0dd)
abort (); FAILURE
if (arg3_64 (0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 3.0dd) if (arg3_64 (0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 3.0dd)
abort (); FAILURE
if (arg4_64 (0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 4.0dd) if (arg4_64 (0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 4.0dd)
abort (); FAILURE
if (arg5_64 (0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 5.0dd) if (arg5_64 (0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 5.0dd)
abort (); FAILURE
/* _Decimal128 variants. */ /* _Decimal128 variants. */
if (arg0_128 (0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 0.0dl) if (arg0_128 (0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 0.0dl)
abort (); FAILURE
if (arg1_128 (0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 1.0dl) if (arg1_128 (0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 1.0dl)
abort (); FAILURE
if (arg2_128 (0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 2.0dl) if (arg2_128 (0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 2.0dl)
abort (); FAILURE
if (arg3_128 (0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 3.0dl) if (arg3_128 (0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 3.0dl)
abort (); FAILURE
if (arg4_128 (0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 4.0dl) if (arg4_128 (0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 4.0dl)
abort (); FAILURE
if (arg5_128 (0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 5.0dl) if (arg5_128 (0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 5.0dl)
FAILURE
if (failcnt != 0)
abort (); abort ();
return 0; return 0;
......
...@@ -5,6 +5,16 @@ ...@@ -5,6 +5,16 @@
point types. */ point types. */
extern void abort (void); extern void abort (void);
static int failcnt;
/* Support compiling the test to report individual failures; default is
to abort as soon as a check fails. */
#ifdef DBG
#include <stdio.h>
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
struct example struct example
{ {
...@@ -79,17 +89,20 @@ ptr_dummy2_field (struct example *s) ...@@ -79,17 +89,20 @@ ptr_dummy2_field (struct example *s)
int int
main () main ()
{ {
if (d32_field (nums) != 3.0df) abort (); if (d32_field (nums) != 3.0df) FAILURE
if (d64_field (nums) != 2.0dd) abort (); if (d64_field (nums) != 2.0dd) FAILURE
if (d128_field (nums) != 1.0dl) abort (); if (d128_field (nums) != 1.0dl) FAILURE
if (dummy1_field (nums) != 'a') abort (); if (dummy1_field (nums) != 'a') FAILURE
if (dummy2_field (nums) != 'b') abort (); if (dummy2_field (nums) != 'b') FAILURE
if (ptr_d32_field (&nums) != 3.0df) abort (); if (ptr_d32_field (&nums) != 3.0df) FAILURE
if (ptr_d64_field (&nums) != 2.0dd) abort (); if (ptr_d64_field (&nums) != 2.0dd) FAILURE
if (ptr_d128_field (&nums) != 1.0dl) abort (); if (ptr_d128_field (&nums) != 1.0dl) FAILURE
if (ptr_dummy1_field (&nums) != 'a') abort (); if (ptr_dummy1_field (&nums) != 'a') FAILURE
if (ptr_dummy2_field (&nums) != 'b') abort (); if (ptr_dummy2_field (&nums) != 'b') FAILURE
if (failcnt != 0)
abort ();
return 0; return 0;
} }
...@@ -106,4 +106,5 @@ int main() ...@@ -106,4 +106,5 @@ int main()
if (failcnt != 0) if (failcnt != 0)
abort (); abort ();
return 0;
} }
...@@ -6,10 +6,20 @@ ...@@ -6,10 +6,20 @@
float types cast to decimal float types. */ float types cast to decimal float types. */
extern void abort (void); extern void abort (void);
static int failcnt;
/* Support compiling the test to report individual failures; default is
to abort as soon as a check fails. */
#ifdef DBG
#include <stdio.h>
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
#define OPERATE(OPRD1,OPRT,OPRD2,RLT) \ #define OPERATE(OPRD1,OPRT,OPRD2,RLT) \
if (( OPRD1 OPRT OPRD2 )!= RLT) \ if (( OPRD1 OPRT OPRD2 )!= RLT) \
abort (); FAILURE
#define DECIMAL_COMPOUND_ASSIGNMENT(TYPE, OPRD) \ #define DECIMAL_COMPOUND_ASSIGNMENT(TYPE, OPRD) \
{ \ { \
...@@ -54,5 +64,8 @@ main () ...@@ -54,5 +64,8 @@ main ()
DECIMAL_COMPOUND_ASSIGNMENT(64, d64); DECIMAL_COMPOUND_ASSIGNMENT(64, d64);
DECIMAL_COMPOUND_ASSIGNMENT(128, d128); DECIMAL_COMPOUND_ASSIGNMENT(128, d128);
if (failcnt != 0)
abort ();
return 0; return 0;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment