* gcc.dg/dfp/dfp.exp: Use appropriate default options.
* gcc.dg/dfp/dfp-dbg.h: New; define FAILURE, FINISH.
* gcc.dg/dfp/cast-bad.c: Use default options.
* gcc.dg/dfp/compare-rel-const.c: Ditto.
* gcc.dg/dfp/composite-type.c: Ditto.
* gcc.dg/dfp/constants.c: Ditto.
* gcc.dg/dfp/constants-hex.c: Ditto.
* gcc.dg/dfp/constants-pedantic.c: Ditto.
* gcc.dg/dfp/convert-bfp-fold.c: Ditto.
* gcc.dg/dfp/convert-dfp-fold.c: Ditto.
* gcc.dg/dfp/convert-int-max-fold.c: Ditto.
* gcc.dg/dfp/ctypes.c: Ditto.
* gcc.dg/dfp/ddmode-ice.c: Ditto.
* gcc.dg/dfp/dec-eval-method-2.c: Ditto.
* gcc.dg/dfp/float-constant-double.c: Ditto.
* gcc.dg/dfp/keywords-pedantic.c: Ditto.
* gcc.dg/dfp/keywords-reserved.c: Ditto.
* gcc.dg/dfp/modes.c: Ditto.
* gcc.dg/dfp/operator-bitwise.c: Ditto.
* gcc.dg/dfp/pr31344.c: Ditto.
* gcc.dg/dfp/pr31385.c: Ditto.
* gcc.dg/dfp/pr33466.c: Ditto.
* gcc.dg/dfp/pr35620.c: Ditto.
* gcc.dg/dfp/pr37435.c: Ditto.
* gcc.dg/dfp/pr39986.c: Ditto.
* gcc.dg/dfp/pragma-float-const-decimal64-1.c: Ditto.
* gcc.dg/dfp/pragma-float-const-decimal64-2.c: Ditto.
* gcc.dg/dfp/pragma-float-const-decimal64-3.c: Ditto.
* gcc.dg/dfp/pragma-float-const-decimal64-4.c: Ditto.
* gcc.dg/dfp/pragma-float-const-decimal64-7.c: Ditto.
* gcc.dg/dfp/pragma-float-const-decimal64-8.c: Ditto.
* gcc.dg/dfp/typespec.c: Ditto.
* gcc.dg/dfp/usual-arith-conv-bad.c: Ditto.
* gcc.dg/dfp/usual-arith-conv-bad-2.c: Ditto.
* gcc.dg/dfp/usual-arith-conv-const.c: Ditto.
* gcc.dg/dfp/Wbad-function-cast-1.c: Ditto.
* gcc.dg/dfp/Wtraditional-conversion-2.c: Ditto.
* gcc.dg/dfp/wtr-conversion-1.c: Ditto.
* gcc.dg/dfp/compare-eq.h: Define custom debug macros.
* gcc.dg/dfp/compare-rel.h: Ditto.
* gcc.dg/dfp/compare-special.h: Ditto.
* gcc.dg/dfp/convert.h: Ditto.
* gcc.dg/dfp/fe-check.h: Ditto.
* gcc.dg/dfp/call-by-value.c: Use default options and
debug macros.
* gcc.dg/dfp/cast.c: Ditto.
* gcc.dg/dfp/compare-eq-const.c: Ditto.
* gcc.dg/dfp/compare-eq-d32.c: Ditto.
* gcc.dg/dfp/compare-eq-d64.c: Ditto.
* gcc.dg/dfp/compare-eq-d128.c: Ditto.
* gcc.dg/dfp/compare-eq-dfp.c: Ditto.
* gcc.dg/dfp/compare-rel-d32.c: Ditto.
* gcc.dg/dfp/compare-rel-d64.c: Ditto.
* gcc.dg/dfp/compare-rel-d128.c: Ditto.
* gcc.dg/dfp/compare-rel-dfp.c: Ditto.
* gcc.dg/dfp/compare-special-d32.c: Ditto.
* gcc.dg/dfp/compare-special-d64.c: Ditto.
* gcc.dg/dfp/compare-special-d128.c: Ditto.
* gcc.dg/dfp/constants-zero.c: Ditto.
* gcc.dg/dfp/convert-bfp-2.c: Ditto.
* gcc.dg/dfp/convert-bfp-3.c: Ditto.
* gcc.dg/dfp/convert-bfp-4.c: Ditto.
* gcc.dg/dfp/convert-bfp-5.c: Ditto.
* gcc.dg/dfp/convert-bfp-6.c: Ditto.
* gcc.dg/dfp/convert-bfp-7.c: Ditto.
* gcc.dg/dfp/convert-bfp-8.c: Ditto.
* gcc.dg/dfp/convert-bfp-9.c: Ditto.
* gcc.dg/dfp/convert-bfp-10.c: Ditto.
* gcc.dg/dfp/convert-bfp-11.c: Ditto.
* gcc.dg/dfp/convert-bfp-12.c: Ditto.
* gcc.dg/dfp/convert-bfp-13.c: Ditto.
* gcc.dg/dfp/convert-bfp-14.c: Ditto.
* gcc.dg/dfp/convert-bfp.c: Ditto.
* gcc.dg/dfp/convert-complex.c: Ditto.
* gcc.dg/dfp/convert-dfp.c: Ditto.
* gcc.dg/dfp/convert-dfp-fold-2.c: Ditto.
* gcc.dg/dfp/convert-dfp-round.c: Ditto.
* gcc.dg/dfp/convert-int.c: Ditto.
* gcc.dg/dfp/convert-int-fold.c: Ditto.
* gcc.dg/dfp/convert-int-max.c: Ditto.
* gcc.dg/dfp/convert-int-saturate.c: Ditto.
* gcc.dg/dfp/decfloat-constants.c: Ditto.
* gcc.dg/dfp/fe-binop.c: Ditto.
* gcc.dg/dfp/fe-convert-1.c: Ditto.
* gcc.dg/dfp/fe-convert-2.c: Ditto.
* gcc.dg/dfp/fe-convert-3.c: Ditto.
* gcc.dg/dfp/func-array.c: Ditto.
* gcc.dg/dfp/func-deref.c: Ditto.
* gcc.dg/dfp/func-mixed.c: Ditto.
* gcc.dg/dfp/func-pointer.c: Ditto.
* gcc.dg/dfp/func-scalar.c: Ditto.
* gcc.dg/dfp/func-struct.c: Ditto.
* gcc.dg/dfp/func-vararg-alternate.h: Ditto.
* gcc.dg/dfp/func-vararg-alternate-d32.c: Ditto.
* gcc.dg/dfp/func-vararg-alternate-d64.c: Ditto.
* gcc.dg/dfp/func-vararg-alternate-d128.c: Ditto.
* gcc.dg/dfp/func-vararg-alternate-d128-2.c: Ditto.
* gcc.dg/dfp/func-vararg-dfp.c: Ditto.
* gcc.dg/dfp/func-vararg-mixed.c: Ditto.
* gcc.dg/dfp/func-vararg-mixed-2.c: Ditto.
* gcc.dg/dfp/func-vararg-size0.c: Ditto.
* gcc.dg/dfp/inf-1.c: Ditto.
* gcc.dg/dfp/loop-index.c: Ditto.
* gcc.dg/dfp/nan-1.c: Ditto.
* gcc.dg/dfp/nan-2.c: Ditto.
* gcc.dg/dfp/operator-arith-fold.c: Ditto.
* gcc.dg/dfp/operator-assignment.c: Ditto.
* gcc.dg/dfp/operator-comma.c: Ditto.
* gcc.dg/dfp/operator-cond.c: Ditto.
* gcc.dg/dfp/operator-logical.c: Ditto.
* gcc.dg/dfp/operator-unary.c: Ditto.
* gcc.dg/dfp/pr36800.c: Ditto.
* gcc.dg/dfp/pr39034.c: Ditto.
* gcc.dg/dfp/pr39035.c: Ditto.
* gcc.dg/dfp/pr39902.c: Ditto.
* gcc.dg/dfp/signbit-1.c: Ditto.
* gcc.dg/dfp/signbit-2.c: Ditto.
* gcc.dg/dfp/struct-layout-1.c: Ditto.
* gcc.dg/dfp/union-init.c: Ditto.
* gcc.dg/dfp/usual-arith-conv.c: Ditto.
From-SVN: r151764
+2009-09-16 Janis Johnson <janis187@us.ibm.com>
+
+ * gcc.dg/dfp/dfp.exp: Use appropriate default options.
+ * gcc.dg/dfp/dfp-dbg.h: New; define FAILURE, FINISH.
+ * gcc.dg/dfp/cast-bad.c: Use default options.
+ * gcc.dg/dfp/compare-rel-const.c: Ditto.
+ * gcc.dg/dfp/composite-type.c: Ditto.
+ * gcc.dg/dfp/constants.c: Ditto.
+ * gcc.dg/dfp/constants-hex.c: Ditto.
+ * gcc.dg/dfp/constants-pedantic.c: Ditto.
+ * gcc.dg/dfp/convert-bfp-fold.c: Ditto.
+ * gcc.dg/dfp/convert-dfp-fold.c: Ditto.
+ * gcc.dg/dfp/convert-int-max-fold.c: Ditto.
+ * gcc.dg/dfp/ctypes.c: Ditto.
+ * gcc.dg/dfp/ddmode-ice.c: Ditto.
+ * gcc.dg/dfp/dec-eval-method-2.c: Ditto.
+ * gcc.dg/dfp/float-constant-double.c: Ditto.
+ * gcc.dg/dfp/keywords-pedantic.c: Ditto.
+ * gcc.dg/dfp/keywords-reserved.c: Ditto.
+ * gcc.dg/dfp/modes.c: Ditto.
+ * gcc.dg/dfp/operator-bitwise.c: Ditto.
+ * gcc.dg/dfp/pr31344.c: Ditto.
+ * gcc.dg/dfp/pr31385.c: Ditto.
+ * gcc.dg/dfp/pr33466.c: Ditto.
+ * gcc.dg/dfp/pr35620.c: Ditto.
+ * gcc.dg/dfp/pr37435.c: Ditto.
+ * gcc.dg/dfp/pr39986.c: Ditto.
+ * gcc.dg/dfp/pragma-float-const-decimal64-1.c: Ditto.
+ * gcc.dg/dfp/pragma-float-const-decimal64-2.c: Ditto.
+ * gcc.dg/dfp/pragma-float-const-decimal64-3.c: Ditto.
+ * gcc.dg/dfp/pragma-float-const-decimal64-4.c: Ditto.
+ * gcc.dg/dfp/pragma-float-const-decimal64-7.c: Ditto.
+ * gcc.dg/dfp/pragma-float-const-decimal64-8.c: Ditto.
+ * gcc.dg/dfp/typespec.c: Ditto.
+ * gcc.dg/dfp/usual-arith-conv-bad.c: Ditto.
+ * gcc.dg/dfp/usual-arith-conv-bad-2.c: Ditto.
+ * gcc.dg/dfp/usual-arith-conv-const.c: Ditto.
+ * gcc.dg/dfp/Wbad-function-cast-1.c: Ditto.
+ * gcc.dg/dfp/Wtraditional-conversion-2.c: Ditto.
+ * gcc.dg/dfp/wtr-conversion-1.c: Ditto.
+ * gcc.dg/dfp/compare-eq.h: Define custom debug macros.
+ * gcc.dg/dfp/compare-rel.h: Ditto.
+ * gcc.dg/dfp/compare-special.h: Ditto.
+ * gcc.dg/dfp/convert.h: Ditto.
+ * gcc.dg/dfp/fe-check.h: Ditto.
+ * gcc.dg/dfp/call-by-value.c: Use default options and
+ debug macros.
+ * gcc.dg/dfp/cast.c: Ditto.
+ * gcc.dg/dfp/compare-eq-const.c: Ditto.
+ * gcc.dg/dfp/compare-eq-d32.c: Ditto.
+ * gcc.dg/dfp/compare-eq-d64.c: Ditto.
+ * gcc.dg/dfp/compare-eq-d128.c: Ditto.
+ * gcc.dg/dfp/compare-eq-dfp.c: Ditto.
+ * gcc.dg/dfp/compare-rel-d32.c: Ditto.
+ * gcc.dg/dfp/compare-rel-d64.c: Ditto.
+ * gcc.dg/dfp/compare-rel-d128.c: Ditto.
+ * gcc.dg/dfp/compare-rel-dfp.c: Ditto.
+ * gcc.dg/dfp/compare-special-d32.c: Ditto.
+ * gcc.dg/dfp/compare-special-d64.c: Ditto.
+ * gcc.dg/dfp/compare-special-d128.c: Ditto.
+ * gcc.dg/dfp/constants-zero.c: Ditto.
+ * gcc.dg/dfp/convert-bfp-2.c: Ditto.
+ * gcc.dg/dfp/convert-bfp-3.c: Ditto.
+ * gcc.dg/dfp/convert-bfp-4.c: Ditto.
+ * gcc.dg/dfp/convert-bfp-5.c: Ditto.
+ * gcc.dg/dfp/convert-bfp-6.c: Ditto.
+ * gcc.dg/dfp/convert-bfp-7.c: Ditto.
+ * gcc.dg/dfp/convert-bfp-8.c: Ditto.
+ * gcc.dg/dfp/convert-bfp-9.c: Ditto.
+ * gcc.dg/dfp/convert-bfp-10.c: Ditto.
+ * gcc.dg/dfp/convert-bfp-11.c: Ditto.
+ * gcc.dg/dfp/convert-bfp-12.c: Ditto.
+ * gcc.dg/dfp/convert-bfp-13.c: Ditto.
+ * gcc.dg/dfp/convert-bfp-14.c: Ditto.
+ * gcc.dg/dfp/convert-bfp.c: Ditto.
+ * gcc.dg/dfp/convert-complex.c: Ditto.
+ * gcc.dg/dfp/convert-dfp.c: Ditto.
+ * gcc.dg/dfp/convert-dfp-fold-2.c: Ditto.
+ * gcc.dg/dfp/convert-dfp-round.c: Ditto.
+ * gcc.dg/dfp/convert-int.c: Ditto.
+ * gcc.dg/dfp/convert-int-fold.c: Ditto.
+ * gcc.dg/dfp/convert-int-max.c: Ditto.
+ * gcc.dg/dfp/convert-int-saturate.c: Ditto.
+ * gcc.dg/dfp/decfloat-constants.c: Ditto.
+ * gcc.dg/dfp/fe-binop.c: Ditto.
+ * gcc.dg/dfp/fe-convert-1.c: Ditto.
+ * gcc.dg/dfp/fe-convert-2.c: Ditto.
+ * gcc.dg/dfp/fe-convert-3.c: Ditto.
+ * gcc.dg/dfp/func-array.c: Ditto.
+ * gcc.dg/dfp/func-deref.c: Ditto.
+ * gcc.dg/dfp/func-mixed.c: Ditto.
+ * gcc.dg/dfp/func-pointer.c: Ditto.
+ * gcc.dg/dfp/func-scalar.c: Ditto.
+ * gcc.dg/dfp/func-struct.c: Ditto.
+ * gcc.dg/dfp/func-vararg-alternate.h: Ditto.
+ * gcc.dg/dfp/func-vararg-alternate-d32.c: Ditto.
+ * gcc.dg/dfp/func-vararg-alternate-d64.c: Ditto.
+ * gcc.dg/dfp/func-vararg-alternate-d128.c: Ditto.
+ * gcc.dg/dfp/func-vararg-alternate-d128-2.c: Ditto.
+ * gcc.dg/dfp/func-vararg-dfp.c: Ditto.
+ * gcc.dg/dfp/func-vararg-mixed.c: Ditto.
+ * gcc.dg/dfp/func-vararg-mixed-2.c: Ditto.
+ * gcc.dg/dfp/func-vararg-size0.c: Ditto.
+ * gcc.dg/dfp/inf-1.c: Ditto.
+ * gcc.dg/dfp/loop-index.c: Ditto.
+ * gcc.dg/dfp/nan-1.c: Ditto.
+ * gcc.dg/dfp/nan-2.c: Ditto.
+ * gcc.dg/dfp/operator-arith-fold.c: Ditto.
+ * gcc.dg/dfp/operator-assignment.c: Ditto.
+ * gcc.dg/dfp/operator-comma.c: Ditto.
+ * gcc.dg/dfp/operator-cond.c: Ditto.
+ * gcc.dg/dfp/operator-logical.c: Ditto.
+ * gcc.dg/dfp/operator-unary.c: Ditto.
+ * gcc.dg/dfp/pr36800.c: Ditto.
+ * gcc.dg/dfp/pr39034.c: Ditto.
+ * gcc.dg/dfp/pr39035.c: Ditto.
+ * gcc.dg/dfp/pr39902.c: Ditto.
+ * gcc.dg/dfp/signbit-1.c: Ditto.
+ * gcc.dg/dfp/signbit-2.c: Ditto.
+ * gcc.dg/dfp/struct-layout-1.c: Ditto.
+ * gcc.dg/dfp/union-init.c: Ditto.
+ * gcc.dg/dfp/usual-arith-conv.c: Ditto.
+
2009-09-16 Michael Matz <matz@suse.de>
PR fortran/41212
/* Based on gcc.dg/Wbad-function-cast-1.c. */
/* { dg-do compile } */
-/* { dg-options "-std=gnu99 -Wbad-function-cast" } */
+/* { dg-options "-Wbad-function-cast" } */
int if1(void);
char if2(void);
(based on gcc.dg/Wtraditional-conversion-2.c). */
/* { dg-do compile } */
-/* { dg-options "-std=gnu99 -Wtraditional-conversion" } */
+/* { dg-options "-Wtraditional-conversion" } */
void fsi(signed int);
void fd32(_Decimal32);
-/* { dg-options "-std=gnu99" } */
-
/* 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. */
-extern void abort (void);
+#include "dfp-dbg.h"
int foo32 (_Decimal32 z)
{
foo32 (d32);
if (d32 != 1.1df)
- abort ();
+ FAILURE
foo64 (d64);
if (d64 != 1.2dd)
- abort ();
+ FAILURE
foo128 (d128);
if (d128 != 1.3dl)
- abort ();
+ FAILURE
- return 0;
+ FINISH
}
/* { dg-do compile } */
-/* { dg-options "-std=gnu99" } */
/* C99 6.5.4 Cast operators.
Test invalid casts involving decimal float. */
-/* { dg-options "-std=gnu99" } */
-
/* C99 6.5.4 Cast operators.
Test valid casts involving decimal float. */
-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
+#include "dfp-dbg.h"
_Decimal32 d32;
_Decimal64 d64;
if (d128 != (_Decimal128) d)
FAILURE
- if (failcnt != 0)
- abort ();
-
- return 0;
+ FINISH
}
-/* { dg-options "-std=gnu99" } */
-
/* C99 6.5.9 Equality operators.
Compare decimal float constants against each other. */
+#include "dfp-dbg.h"
+
extern void link_error (void);
int
if (1.4dd + 1.4dd + 1.4dd != 4.2dd)
link_error ();
- return 0;
+ FINISH
}
-/* { dg-options "-std=gnu99 -O0" } */
+/* { dg-options "-O0" } */
/* C99 6.5.9 Equality operators.
Compare decimal float values against each other at runtime. */
int main ()
{
test_compares ();
- return 0;
+
+ FINISH
}
-/* { dg-options "-std=gnu99 -O0" } */
+/* { dg-options "-O0" } */
/* C99 6.5.9 Equality operators.
Compare decimal float values against each other at runtime. */
int main ()
{
test_compares ();
- return 0;
+
+ FINISH
}
-/* { dg-options "-std=gnu99 -O0" } */
+/* { dg-options "-O0" } */
/* C99 6.5.9 Equality operators.
Compare decimal float values against each other at runtime. */
int main ()
{
test_compares ();
- return 0;
+
+ FINISH
}
-/* { dg-options "-std=gnu99 -O0" } */
+/* { dg-options "-O0" } */
/* C99 6.5.9 Equality operators.
Compare decimal float values against variables of different types. */
-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
+#include "dfp-dbg.h"
_Decimal32 d32;
_Decimal64 d64;
compare_dfp ();
- if (failcnt)
- abort ();
- return 0;
+ FINISH
}
are not affected by rounding. */
#include <stdlib.h>
-
-static int failcnt;
+#include "dfp-dbg.h"
#define PASTE2(A,B) A ## B
#define PASTE(A,B) PASTE2(A,B)
+#undef FAILURE
#ifdef DBG
-#include <stdio.h>
#define FAILURE(OP,KIND) \
{ printf ("failed at line %d: %s for %s values\n", __LINE__, OP, KIND); \
- failcnt++; }
+ failures++; }
#else
-#define FAILURE(OP,KIND) abort ();
+#define FAILURE(OP,KIND) __builtin_abort ();
#endif
#ifndef WIDTH
if (! (x != zero)) FAILURE ("!=", "greater")
if (! (y != m_one)) FAILURE ("!=", "greater")
if (! (z != m_two)) FAILURE ("!=", "greater")
-
- if (failcnt)
- abort ();
}
-/* { dg-options "-std=gnu99" } */
-
/* C99 6.5.8 Relational operators.
Compare decimal float constants against each other. */
-/* { dg-options "-std=gnu99 -O0" } */
+/* { dg-options "-O0" } */
/* C99 6.5.8 Relational operators.
Compare decimal float values against each other at runtime. */
main ()
{
test_compares ();
- return 0;
+ FINISH
}
-/* { dg-options "-std=gnu99 -O0" } */
+/* { dg-options "-O0" } */
/* C99 6.5.8 Relational operators.
Compare decimal float values against each other at runtime. */
main ()
{
test_compares ();
- return 0;
+ FINISH
}
-/* { dg-options "-std=gnu99 -O0" } */
+/* { dg-options "-O0" } */
/* C99 6.5.8 Relational operators.
Compare decimal float values against each other at runtime. */
main ()
{
test_compares ();
- return 0;
+ FINISH
}
-/* { dg-options "-std=gnu99 -O0" } */
+/* { dg-options "-O0" } */
/* C99 6.5.8 Relational operators.
Compare decimal float values against variables of different types. */
-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
+#include "dfp-dbg.h"
_Decimal32 d32;
_Decimal64 d64;
compare_dfp ();
- if (failcnt)
- abort ();
- return 0;
+ FINISH
}
are not affected by rounding. */
#include <stdlib.h>
+#include "dfp-dbg.h"
-static int failcnt;
-
-#define PASTE2(A,B) A ## B
-#define PASTE(A,B) PASTE2(A,B)
-
+#undef FAILURE
#ifdef DBG
-#include <stdio.h>
#define FAILURE(OP,KIND) \
{ printf ("failed at line %d: %s for %s values\n", __LINE__, OP, KIND); \
- failcnt++; }
+ failures++; }
#else
-#define FAILURE(OP,KIND) abort ();
+#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 (y > one) FAILURE (">", "greater")
if (z > zero) FAILURE (">", "greater")
if (z > one) FAILURE (">", "greater")
-
- if (failcnt)
- abort ();
}
-/* { dg-options "-std=gnu99 -O0" } */
+/* { dg-options "-O0" } */
/* C99 6.5.8 Relational operators.
C99 6.5.9 Equality operators.
main ()
{
test_compares ();
- return 0;
+ FINISH
}
-/* { dg-options "-std=gnu99 -O0" } */
+/* { dg-options "-O0" } */
/* C99 6.5.8 Relational operators.
C99 6.5.9 Equality operators.
main ()
{
test_compares ();
- return 0;
+ FINISH
}
-/* { dg-options "-std=gnu99 -O0" } */
+/* { dg-options "-O0" } */
/* C99 6.5.8 Relational operators.
C99 6.5.9 Equality operators.
main ()
{
test_compares ();
- return 0;
+ FINISH
}
/* Basic test of runtime relational comparisons using NaNs and infinities. */
#include <stdlib.h>
-
-static int failcnt;
+#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
-#include <stdio.h>
#define FAILURE(OP,KIND) \
{ printf ("failed at line %d: %s for %s values\n", __LINE__, OP, KIND); \
- failcnt++; }
+ failures++; }
#else
-#define FAILURE(OP,KIND) abort ();
+#define FAILURE(OP,KIND) __builtin_abort ();
#endif
#ifndef WIDTH
if (!(y != m_inf)) FAILURE ("!=", "inf")
if (!(z != inf)) FAILURE ("!=", "inf")
if (z != m_inf) FAILURE ("!=", "inf")
-
- if (failcnt)
- abort ();
}
/* { dg-do compile } */
-/* { dg-options "-std=gnu99 -O -Wall" } */
+/* { dg-options "-O -Wall" } */
/* C99 6.2.7: Compatible type and composite type. */
/* { dg-do compile } */
-/* { dg-options "-std=gnu99" } */
/* N1150 6: Constants.
C99 6.4.4.2: Floating constants.
/* { dg-do compile } */
-/* { dg-options "-std=gnu99 -pedantic" } */
+/* { dg-options "-pedantic" } */
/* N1150 6: Constants.
C99 6.4.4.2: Floating constants. */
+#include "dfp-dbg.h"
+
_Decimal32 a = 1.1df; /* { dg-warning "GCC extension|ISO C" } */
_Decimal32 b = -.003DF; /* { dg-warning "GCC extension|ISO C" } */
_Decimal64 c = 11e-1dl; /* { dg-warning "GCC extension|ISO C" } */
-/* { dg-options "-std=gnu99 -O0" } */
+/* { 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. */
-extern void abort (void);
+#include "dfp-dbg.h"
int big_endian;
dpd_tests (void)
{
if (! compare32 (0.DF, 0x22500000U))
- abort ();
+ FAILURE
if (! compare32 (-0.DF, 0xa2500000U))
- abort ();
+ FAILURE
if (! compare32 (0.E-4DF, 0x22100000U))
- abort ();
+ FAILURE
if (! compare32 (0.E-7DF, 0x21e00000U))
- abort ();
+ FAILURE
if (! compare32 (0.E+3DF, 0x22800000U))
- abort ();
+ FAILURE
if (! compare64 (0.DD, 0x2238000000000000ULL))
- abort ();
+ FAILURE
if (! compare64 (-0.DD, 0xa238000000000000ULL))
- abort ();
+ FAILURE
if (! compare64 (0.E-6DD, 0x2220000000000000ULL))
- abort ();
+ FAILURE
if (! compare64 (0.E-7DD, 0x221c000000000000ULL))
- abort ();
+ FAILURE
if (! compare64 (0.E+2DD, 0x2240000000000000ULL))
- abort ();
+ FAILURE
if (! compare128 (0.DL, 0x2208000000000000ULL, 0x0000000000000000ULL))
- abort ();
+ FAILURE
if (! compare128 (-0.DL, 0xa208000000000000ULL, 0x0000000000000000ULL))
- abort ();
+ FAILURE
if (! compare128 (0.E-3DL, 0x2207400000000000ULL, 0x0000000000000000ULL))
- abort ();
+ FAILURE
if (! compare128 (0.E-8DL, 0x2206000000000000ULL, 0x0000000000000000ULL))
- abort ();
+ FAILURE
if (! compare128 (0.E+2DL, 0x2208800000000000ULL, 0x0000000000000000ULL))
- abort ();
+ FAILURE
}
void
bid_tests (void)
{
if (! compare32 (0.DF, 0x32800000U))
- abort ();
+ FAILURE
if (! compare32 (-0.DF, 0xb2800000U))
- abort ();
+ FAILURE
if (! compare32 (0.E-4DF, 0x30800000U))
- abort ();
+ FAILURE
if (! compare32 (0.E-7DF, 0x2f000000U))
- abort ();
+ FAILURE
if (! compare32 (0.E+3DF, 0x34000000U))
- abort ();
+ FAILURE
if (! compare64 (0.DD, 0x31c0000000000000ULL))
- abort ();
+ FAILURE
if (! compare64 (-0.DD, 0xb1c0000000000000ULL))
- abort ();
+ FAILURE
if (! compare64 (0.E-6DD, 0x3100000000000000ULL))
- abort ();
+ FAILURE
if (! compare64 (0.E-7DD, 0x30e0000000000000ULL))
- abort ();
+ FAILURE
if (! compare64 (0.E+2DD, 0x3200000000000000ULL))
- abort ();
+ FAILURE
if (! compare128 (0.DL, 0x3040000000000000ULL, 0x0000000000000000ULL))
- abort ();
+ FAILURE
if (! compare128 (-0.DL, 0xb040000000000000ULL, 0x0000000000000000ULL))
- abort ();
+ FAILURE
if (! compare128 (0.E-3DL, 0x303a000000000000ULL, 0x0000000000000000ULL))
- abort ();
+ FAILURE
if (! compare128 (0.E-8DL, 0x3030000000000000ULL, 0x0000000000000000ULL))
- abort ();
+ FAILURE
if (! compare128 (0.E+2DL, 0x3044000000000000ULL, 0x0000000000000000ULL))
- abort ();
+ FAILURE
}
int
if ((sizeof (_Decimal64) != sizeof (long long))
|| (sizeof (_Decimal128) != 2 * sizeof (long long))
|| (sizeof (_Decimal32) != sizeof (_Decimal32)))
- abort ();
+ FAILURE
u32.d = 1.DF;
bid_tests ();
}
else
- abort (); /* unknown format; test problem */
+ FAILURE /* unknown format; test problem */
- return 0;
+ FINISH
}
/* { dg-do compile } */
-/* { dg-options "-std=gnu99" } */
/* N1150 6: Constants.
C99 6.4.4.2: Floating constants. */
-/* { dg-options "-std=gnu99" } */
-
/* This test assumes IEEE float and double. */
#define __STDC_WANT_DEC_FP__
convert_246 ();
convert_247 ();
- if (failcnt != 0)
- abort ();
- return 0;
+ FINISH
}
-/* { dg-options "-std=gnu99" } */
/* { dg-skip-if "" { ! "powerpc*-*-linux*" } { "*" } { "" } } */
/* Test decimal float conversions to and from IBM 128-bit long double.
convert_311 ();
convert_312 ();
- if (failcnt != 0)
- abort ();
- return 0;
+ FINISH
}
/* Test for bug where fold wrongly removed conversions to double and
replaced them by conversions to float. */
-/* { dg-options "-std=gnu99" } */
-extern void abort (void);
-extern void exit (int);
+#include "dfp-dbg.h"
volatile float f = __builtin_inff ();
volatile _Decimal32 d32 = 1e40DF;
main (void)
{
if ((double) f == (double) d32)
- abort ();
- exit (0);
+ FAILURE
+
+ FINISH
}
/* Test for bug where fold changed binary operation to decimal
depending on typedefs. */
-/* { dg-options "-std=gnu99" } */
-extern void abort (void);
-extern void exit (int);
+#include "dfp-dbg.h"
volatile double d = 1.2345675;
_Decimal32 a = (d * d);
d32 b = (d * d);
if (a != b)
- abort ();
- exit (0);
+ FAILURE
+ FINISH
}
/* Test for bug where fold narrowed decimal floating-point
operations. */
-/* { dg-options "-std=gnu99" } */
-extern void abort (void);
-extern void exit (int);
+#include "dfp-dbg.h"
volatile _Decimal32 f = 1.23456DF;
volatile _Decimal64 d = 1.23456DD;
main (void)
{
if ((double)((_Decimal64)f * (_Decimal64)f) != (double)(d * d))
- abort ();
- exit (0);
+ FAILURE
+ FINISH
}
-/* { dg-options "-std=gnu99" } */
-
/* This test assumes IEEE float and double. It also tests long double
but makes no assumption about its size or range of values. */
CALL_VALID_ALL (t6)
CALL_VALID_ALL (t7)
- if (failcnt != 0)
- abort ();
- return 0;
+ FINISH
}
-/* { dg-options "-std=gnu99" } */
-
/* This test assumes IEEE float and double. It also tests long double
but makes no assumption about its size or range of values. */
{
CALL_ZEROES_ALL (t)
- if (failcnt != 0)
- abort ();
- return 0;
+ FINISH
}
-/* { dg-options "-std=gnu99" } */
-
/* This test assumes IEEE float and double. It also tests long double
but makes no assumption about its size or range of values. */
{
CALL_INF_ALL (t)
- if (failcnt != 0)
- abort ();
- return 0;
+ FINISH
}
-/* { dg-options "-std=gnu99" } */
-
/* This test assumes IEEE float and double. It also tests long double
but makes no assumption about its size or range of values. */
{
CALL_NAN_ALL (t)
- if (failcnt != 0)
- abort ();
- return 0;
+ FINISH
}
/* { dg-xfail-run-if "" { lax_strtofp } "*" "" } */
-/* { dg-options "-std=gnu99 -w" } */
+/* { dg-options "-w" } */
/* This test assumes IEEE float and double. */
convert_364 ();
}
- if (failcnt != 0)
- abort ();
- return 0;
+ FINISH
}
-/* { dg-options "-std=gnu99 -w" } */
+/* { dg-options "-w" } */
/* This test assumes IEEE float and double. */
convert_351 ();
convert_352 ();
- if (failcnt != 0)
- abort ();
- return 0;
+ FINISH
}
-/* { dg-options "-std=gnu99 -w" } */
+/* { dg-options "-w" } */
/* This test assumes IEEE float and double. */
convert_443 ();
convert_444 ();
- if (failcnt != 0)
- abort ();
- return 0;
+ FINISH
}
/* { dg-xfail-run-if "" { lax_strtofp } "*" "" } */
-/* { dg-options "-std=gnu99 -w" } */
+/* { dg-options "-w" } */
/* This test assumes IEEE float and double. */
convert_419 ();
convert_420 ();
- if (failcnt != 0)
- abort ();
- return 0;
+ FINISH
}
-/* { dg-options "-std=gnu99 -O2" } */
+/* { dg-options "-O2" } */
/* N1150 5.2 Conversions among decimal floating types and between
decimal floating types and generic floating types.
-/* { dg-options "-std=gnu99" } */
-
/* 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. */
-extern void abort (void);
-static int failcnt;
-static int skip_long_double;
+#include "dfp-dbg.h"
-/* 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
+static int skip_long_double;
volatile _Decimal32 d32;
volatile _Decimal64 d64;
|| df > (2.9802322387695312e-08 + 0.00000000001))
FAILURE
- if (failcnt != 0)
- abort ();
-
- return 0;
+ FINISH
}
/* N1150 5.3 Conversions between decimal floating and complex.
C99 6.3.1.7 Conversions, arithmetic operands, real and complex. */
-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
+#include "dfp-dbg.h"
int
main ()
if (d128 != 0.0625DL)
FAILURE
- if (failcnt != 0)
- abort ();
-
- return 0;
+ FINISH
}
/* Test for bug where fold narrowed decimal floating-point
operations. */
-/* { dg-options "-std=gnu99" } */
-extern void abort (void);
-extern void exit (int);
+#include "dfp-dbg.h"
volatile _Decimal32 f = 1.23456DF;
volatile _Decimal64 d = 1.23456DD;
main (void)
{
if ((_Decimal128)((_Decimal64)f * (_Decimal64)f) != (_Decimal128)(d * d))
- abort ();
- exit (0);
+ FAILURE
+ FINISH
}
-/* { dg-options "-std=gnu99 -O2" } */
+/* { dg-options "-O2" } */
/* N1150 5.2 Conversions among decimal floating types and between
decimal floating types and generic floating types.
-/* { dg-options "-O0 -std=gnu99" } */
+/* { dg-options "-O0" } */
/* { dg-skip-if "test is for emulation" { hard_dfp } { "*" } { "" } } */
/* N1150 5.2: Conversions among decimal floating types and between
Normally this would not be part of compiler testing, but conversions
are currently handled in libgcc via decNumber. */
+#include "dfp-dbg.h"
#include "dfp-round.h"
-extern void abort (void);
-static int failcnt = 0;
-
-/* 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
-
_Decimal32 d32;
_Decimal64 d64;
_Decimal128 d128;
if (!do_d128_to_d64 (-1.1111111111111125dl, -1.111111111111112dd)) FAILURE
if (!do_d128_to_d64 (-1.1111111111111135dl, -1.111111111111113dd)) FAILURE
- if (failcnt)
- abort ();
- return 0;
+ FINISH
}
-/* { dg-options "-std=gnu99 -O0" } */
+/* { dg-options "-O0" } */
/* N1150 5.2 Conversions among decimal floating types and between
decimal floating types and generic floating types.
#define __STDC_WANT_DEC_FP__ 1
#endif
+#include "dfp-dbg.h"
#include <float.h>
-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 _Decimal64 d64;
volatile _Decimal128 d128;
if (d64 != __builtin_infd64())
FAILURE
- if (failcnt != 0)
- abort ();
-
- return 0;
+ FINISH
}
-/* { dg-options "-std=gnu99 -O2" } */
+/* { 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"
+
+#define BOOL _Bool
+
extern void link_error (void);
int
int si;
long sl;
long long sll;
- _Bool b;
+ BOOL b;
/* C99 Section 6.7.2 Type specifiers. Type _Bool is
mentioned in this section. Conversions between
- _Bool and DFP types. */
+ BOOL and DFP types. */
/* Decimal float to unsigned integer. */
d32 = 456.789df;
/* Decimal float to signed integer. */
- /* Decimal float to _Bool. */
+ /* Decimal float to BOOL. */
d32 = 1.23df;
d64 = -3.4dd;
d128 = 0.00003dl;
if (d128 != -1234567.dl)
link_error ();
- /* _Bool to decimal float. */
+ /* BOOL to decimal float. */
d32 = 0.0DF;
d64 = 0.0DD;
d128 = 0.0DL;
-/* { dg-options "-std=gnu99 -O2" } */
+/* { dg-options "-O2 -w" } */
/* N1150 5.1 Conversions from decimal float to integer. */
-/* { dg-options "-std=gnu99 -O0" } */
+/* { dg-options "-O0 -w" } */
/* N1150 5.1 Conversions from decimal float to integer. */
what will fit into the destination type. This assumes 32-bit int and
64-bit long long (there's a check for that below). */
-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
+#include "dfp-dbg.h"
volatile _Decimal32 d32;
volatile _Decimal64 d64;
doit ();
- if (failcnt != 0)
- abort ();
- return 0;
+ FINISH
}
-/* { dg-options "-std=gnu99" } */
-
/* N1150 5.1 Conversion between decimal floating integer.
C99 6.3.1.4(1a) New.
Test integer saturation. */
#define __STDC_WANT_DEC_FP__ 1
#endif
+#include "dfp-dbg.h"
#include <float.h>
#include <limits.h>
-extern void abort (void);
-
volatile _Decimal32 d32;
volatile _Decimal64 d64;
volatile _Decimal128 d128;
/* Unsigned. */
usi = DEC32_MAX; /* { dg-warning "overflow in implicit constant conversion" } */
if (usi != UINT_MAX)
- abort ();
+ FAILURE
usi = DEC64_MAX; /* { dg-warning "overflow in implicit constant conversion" } */
if (usi != UINT_MAX)
- abort ();
+ FAILURE
usi = DEC128_MAX; /* { dg-warning "overflow in implicit constant conversion" } */
if (usi != UINT_MAX)
- abort ();
+ FAILURE
/* Signed. */
si = DEC32_MAX; /* { dg-warning "overflow in implicit constant conversion" } */
if (si != INT_MAX)
- abort ();
+ FAILURE
si = DEC64_MAX; /* { dg-warning "overflow in implicit constant conversion" } */
if (si != INT_MAX)
- abort ();
+ FAILURE
si = DEC128_MAX; /* { dg-warning "overflow in implicit constant conversion" } */
if (si != INT_MAX)
- abort ();
+ FAILURE
si = - DEC32_MAX; /* { dg-warning "overflow in implicit constant conversion" } */
if (si != INT_MIN)
- abort ();
+ FAILURE
si = - DEC64_MAX; /* { dg-warning "overflow in implicit constant conversion" } */
if (si != INT_MIN)
- abort ();
+ FAILURE
si = - DEC128_MAX; /* { dg-warning "overflow in implicit constant conversion" } */
if (si != INT_MIN)
- abort ();
+ FAILURE
- return 0;
+ FINISH
}
-/* { dg-options "-std=gnu99 -O0" } */
+/* { dg-options "-O0" } */
/* N1150 5.1 Conversion between decimal floating types and integer.
C99 6.3.1.4(1a) New. */
-extern void abort (void);
-int failcnt;
+#include "dfp-dbg.h"
-#ifdef DBG
-extern int printf (const char *, ...);
-#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
-#else
-#define FAILURE abort ();
-#endif
+#define BOOL _Bool
_Decimal32 d32;
_Decimal64 d64;
int si;
long sl;
long long sll;
-_Bool b;
+BOOL b;
void
init_dfp_1 (void)
{
/* C99 Section 6.7.2 Type specifiers. Type _Bool is
mentioned in this section. Conversions between
- _Bool and DFP types. */
+ BOOL and DFP types. */
/* Decimal float to unsigned integer. */
init_dfp_1 ();
/* Decimal float to signed integer. */
- /* Decimal float to _Bool. */
+ /* Decimal float to BOOL. */
init_dfp_2 ();
b = d32;
if (d128 != -1234567.dl)
FAILURE
- /* _Bool to decimal float. */
+ /* BOOL to decimal float. */
init_dfp_3 ();
b = d32;
if (b)
FAILURE
- if (failcnt != 0)
- abort ();
-
- return 0;
+ FINISH
}
-extern void abort (void);
-static int failcnt = 0;
+#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
#define USE_TF 1
#endif
-/* Support compiling the test to report individual failures; default is
- to abort as soon as a check fails. */
+/* 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); failcnt++; }
+ { printf ("failed for test %s\n", NUM); failures++; }
#else
-#define FAILURE(N) abort ();
+#define FAILURE(N) __builtin_abort ();
#endif
/* This is useful when modifying the test to make sure that tests are
/* { dg-do compile } */
-/* { dg-options "-std=gnu99" } */
/* N1150 3: Decimal floating types.
C99 6.7.2: Type specifiers */
/* { dg-do compile } */
-/* { dg-options "-std=gnu99 -O1" } */
+/* { dg-options "-O1" } */
/* This used to result in an ICE. */
/* { dg-do compile } */
-/* { dg-options "-std=gnu99 -D__STDC_WANT_DEC_FP__" } */
+/* { dg-options "-D__STDC_WANT_DEC_FP__" } */
/* N1107 4: Characteristics of decimal floating types <float.h>.
C99 5.2.4.2.2a[2] (New).
-/* { dg-options "-std=gnu99" } */
-
/* N1150 4: Characteristics of decimal floating types <float.h>.
C99 5.2.4.2.2a[3]: New.
#define __STDC_WANT_DEC_FP__ 1
#endif
+#include "dfp-dbg.h"
#include <float.h>
-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
-
int main ()
{
if (DEC32_MANT_DIG != 7) FAILURE
if (DEC128_SUBNORMAL_MIN != 0.000000000000000000000000000000001E-6143DL)
FAILURE
- if (failcnt != 0)
- abort ();
-
- return 0;
+ FINISH
}
--- /dev/null
+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
}
verbose "dfp.exp: dg-do-what-default is ${dg-do-what-default}" 2
-# If a testcase doesn't have special options, use these.
global DEFAULT_CFLAGS
-if ![info exists DEFAULT_CFLAGS] then {
- set DEFAULT_CFLAGS " -ansi -pedantic-errors"
+if [info exists DEFAULT_CFLAGS] then {
+ set save_default_cflags DEFAULT_CFLAGS
}
+# If a testcase doesn't have special options, use these.
+set DEFAULT_CFLAGS "-std=gnu99"
+
# Initialize `dg'.
dg-init
set dg-do-what-default ${save-dg-do-what-default}
verbose "dfp.exp: dg-do-what-default is ${dg-do-what-default}" 2
+if [info exists save_default_cflags] {
+ set DEFAULT_CFLAGS $save_default_cflags
+}
-/* { dg-options "-std=gnu99" } */
/* { dg-skip-if "test is for emulation" { hard_dfp } { "*" } { "" } } */
/* Touch tests that check for raising appropriate exceptions for binary
binop_501 ();
binop_502 ();
- if (failcnt != 0)
- abort ();
- return 0;
+ FINISH
}
are raised for decimal float operations. These tests are here to test
the software decimal float support in libgcc. */
+#include "dfp-dbg.h"
#include "dfp-except.h"
-extern void abort (void);
-static int failcnt = 0;
-
-/* Support compiling the test to report individual failures; default is
- to abort as soon as a check fails. */
#if defined(DBG) || defined(DBG2)
#include <stdio.h>
+#undef FAILURE
#define FAILURE(NUM,KIND,EXCEPT) \
- { printf ("failed for test %d: %s %s\n", NUM, KIND, EXCEPT); failcnt++; }
+ { printf ("failed for test %d: %s %s\n", NUM, KIND, EXCEPT); failures++; }
#else
-#define FAILURE(N,K,E) abort ();
+#undef FAILURE
+#define FAILURE(N,K,E) __builtin_abort ();
#endif
/* This is useful when modifying the test to make sure that tests are
-/* { dg-options "-std=gnu99" } */
/* { dg-skip-if "test is for emulation" { hard_dfp } { "*" } { "" } } */
/* Check that appropriate exceptions are raised for conversions involving
convert_121 ();
convert_122 ();
- if (failcnt != 0)
- abort ();
- return 0;
+ FINISH
}
-/* { dg-options "-std=gnu99" } */
-
/* Check that appropriate exceptions are raised for BFP to DFP conversions.
The test only uses double and _Decimal32; tests for conversions to
_Decimal64 would need 128-bit long double. */
convert_104 ();
convert_105 ();
- if (failcnt != 0)
- abort ();
- return 0;
+ FINISH
}
-/* { dg-options "-std=gnu99" } */
-
/* Check that appropriate exceptions are raised for int to DFP conversions. */
#include "fe-check.h"
convert_210 ();
convert_211 ();
- if (failcnt != 0)
- abort ();
- return 0;
+ FINISH
}
/* { dg-do compile } */
-/* { dg-options "-std=gnu99" } */
/* Constant float values of type double in <float.h> are suffixed with L
and cast to double so they can be used within code that uses pragma
-/* { dg-options "-std=gnu99" } */
-
/* C99 6.5.2.2 Function calls.
Test passing array elements involving decimal floating point types. */
-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
+#include "dfp-dbg.h"
/* A handful of functions that return the Nth _Decimal32 argument of
an incoming array. */
if (arg4_128 (d128) != 4.0dl) FAILURE
if (arg5_128 (d128) != 5.0dl) FAILURE
- if (failcnt != 0)
- abort ();
-
- return 0;
+ FINISH
}
-/* { dg-options "-std=gnu99" } */
-
/* C99 6.5.2.2 Function calls.
Test scalar passing and return values involving decimal floating
point types and dereferenced pointers. */
-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
+#include "dfp-dbg.h"
/* A handful of functions that return their Nth _Decimal32
argument. */
if (arg5_128 (*pdl0, *pdl1, *pdl2, *pdl3, *pdl4, *pdl5) != 5.0dl)
FAILURE
- if (failcnt != 0)
- abort ();
-
- return 0;
+ FINISH
}
-/* { dg-options "-std=gnu99 -Wall" } */
+/* { dg-options "-Wall" } */
/* C99 6.5.2.2 Function calls.
Test scalar passing and return values involving decimal floating
point types. */
-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
+#include "dfp-dbg.h"
/* A handful of functions that return their Nth _Decimal32
argument with mixed types in parameter list. */
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
- if (failcnt != 0)
- abort ();
-
- return 0;
+ FINISH
}
-/* { dg-options "-std=gnu99" } */
-
/* C99 6.5.2.2 Function calls.
Test pointer argument passing and return values involving decimal floating
point types. */
-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
+#include "dfp-dbg.h"
/* A handful of functions that return their Nth pointer to Decimal32
argument. */
if (*arg5_128 (pdl0, pdl1, pdl2, pdl3, pdl4, pdl5) != 5.0dl)
FAILURE
- if (failcnt != 0)
- abort ();
-
- return 0;
+ FINISH
}
-/* { dg-options "-std=gnu99" } */
-
/* C99 6.5.2.2 Function calls.
Test scalar passing and return values involving decimal floating
point types. */
-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
+#include "dfp-dbg.h"
/* A handful of functions that return their Nth _Decimal32
argument. */
if (arg5_128 (0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 5.0dl)
FAILURE
- if (failcnt != 0)
- abort ();
-
- return 0;
+ FINISH
}
-/* { dg-options "-std=gnu99" } */
-
/* C99 6.5.2.2 Function calls.
Test structure passing and return values involving decimal floating
point types. */
-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
+#include "dfp-dbg.h"
struct example
{
if (ptr_dummy1_field (&nums) != 'a') FAILURE
if (ptr_dummy2_field (&nums) != 'b') FAILURE
- if (failcnt != 0)
- abort ();
-
- return 0;
+ FINISH
}
/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
-/* { dg-options "-std=gnu99 -mpreferred-stack-boundary=2" } */
+/* { dg-options "-mpreferred-stack-boundary=2" } */
/* Simple test of vararg passing for problematic types with and without
double values passed between them. */
main ()
{
doit ();
- return 0;
+
+ FINISH
}
-/* { dg-options "-std=gnu99" } */
-
/* Simple test of vararg passing for problematic types with and without
double values passed between them. */
main ()
{
doit ();
- return 0;
+
+ FINISH
}
-/* { dg-options "-std=gnu99" } */
-
/* Simple test of vararg passing for problematic types with and without
double values passed between them. */
main ()
{
doit ();
- return 0;
+
+ FINISH
}
-/* { dg-options "-std=gnu99" } */
-
/* Simple test of vararg passing for problematic types with and without
double values passed between them. */
main ()
{
doit ();
- return 0;
+
+ FINISH
}
/* Simple test of vararg passing for problematic types with and without
double values passed between them. */
+#include "dfp-dbg.h"
#include <stdarg.h>
-#ifdef DBG
-#include <stdio.h>
-#endif
-extern void abort (void);
-
-int failcnt;
DTYPE a[10];
double b[10];
{
int j;
+ failures++;
printf ("line %-3d", line);
for (j = 0; j < n; j++)
printf (" %08x", p[j]);
return;
}
#else
- abort ();
+ __builtin_abort ();
#endif
}
printf ("test error: INTS = %d, sizeof (DTYPE) = %d\n",
INTS, sizeof (DTYPE));
#endif
- abort ();
+ __builtin_abort ();
}
x = ONE / THREE;
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__);
-
- if (failcnt != 0)
- abort ();
}
-/* { dg-options "-std=gnu99" } */
-
/* C99 6.5.2.2 Function calls.
Test passing varargs of the decimal float types. */
#include <stdarg.h>
-
-extern void abort (void);
-static int failcnt = 0;
-
-/* 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
+#include "dfp-dbg.h"
static _Decimal32
vararg32 (unsigned arg, ...)
if (vararg128 (5, 0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 5.0dl)
FAILURE
- if (failcnt != 0)
- abort ();
- return 0;
+ FINISH
}
/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
-/* { dg-options "-std=gnu99 -mpreferred-stack-boundary=2" } */
+/* { 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>
-
-extern void abort (void);
-static int failcnt = 0;
-
-/* 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
+#include "dfp-dbg.h"
/* Supposing the list of varying number of arguments is:
unsigned int, _Decimal128, double, _Decimal32, _Decimal64. */
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
- if (failcnt != 0)
- abort ();
- return 0;
+ FINISH
}
-/* { dg-options "-std=gnu99" } */
-
/* C99 6.5.2.2 Function calls.
Test passing varargs of the combination of decimal float types and
other types. */
#include <stdarg.h>
-
-extern void abort (void);
-static int failcnt = 0;
-
-/* 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
+#include "dfp-dbg.h"
/* Supposing the list of varying number of arguments is:
unsigned int, _Decimal128, double, _Decimal32, _Decimal64. */
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
- if (failcnt != 0)
- abort ();
- return 0;
+ FINISH
}
-/* { dg-options "-std=gnu99" } */
-
/* C99 6.5.2.2 Function calls. */
#include <stdarg.h>
-
-extern void abort (void);
+#include "dfp-dbg.h"
struct S1
{
struct S1 a1[5];
if (check_var(5, 1.0, s1, 2LL, a1[2], a1[2]) == 0)
- abort ();
+ FAILURE
- return 0;
+ FINISH
}
-/* { dg-options "-std=gnu99" } */
-
/* 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. */
-extern void abort (void);
+#include "dfp-dbg.h"
int main()
{
/* Assumes rounding mode. */
if (9999999.E90DF + 1.E90df != __builtin_infd32 ())
- abort ();
+ FAILURE
if (!__builtin_isinfd32 (9999999.E90DF + 1.E90df))
- abort ();
+ FAILURE
if (9.999999999999999E384dd + .000000000000001e384dd
!= __builtin_infd32 ())
- abort ();
+ FAILURE
if (-9999999.E90DF - 1.E90df != -__builtin_infd32 ())
- abort ();
+ FAILURE
if (!__builtin_isinfd32 (9.999999999999999E384dd + .000000000000001e384dd))
- abort ();
+ FAILURE
if (7.999999999999999999999999999999999E6144dl + 3.0E6144dl
!= __builtin_infd32 ())
- abort ();
+ FAILURE
if (__builtin_infd32 () * __builtin_infd32 () != __builtin_infd32 ())
- abort ();
+ FAILURE
if (__builtin_infd32 () * 2 != __builtin_infd32 ())
- abort ();
+ FAILURE
if (__builtin_infd64 () * -5 != -__builtin_infd32 ())
- abort ();
+ FAILURE
if (!__builtin_isinfd128 (__builtin_infd32 () / 4))
- abort ();
+ FAILURE
if (__builtin_infd64 () != __builtin_infd128 ())
- abort ();
+ FAILURE
if (!__builtin_isinfd64 (__builtin_infd128 ()))
- abort ();
+ FAILURE
if (__builtin_finited64 (__builtin_infd32 () * 4))
- abort ();
+ FAILURE
if (!__builtin_finited128 (9.999999E90DL - 1.E90dd))
- abort ();
+ FAILURE
if (__builtin_finited128 (__builtin_infd32 () *__builtin_infd128 ()))
- abort ();
+ FAILURE
if (__builtin_finited32 (__builtin_nand32 ("")))
- abort ();
-
- return 0;
+ FAILURE
+
+ FINISH
}
/* { dg-do compile } */
-/* { dg-options "-std=gnu99 -pedantic" } */
+/* { dg-options "-pedantic" } */
/* Decimal float is a GCC extension. */
/* { dg-do compile } */
-/* { dg-options "-std=gnu99" } */
/* N1150 3: Decimal floating types.
C99 6.4.1(2): Keywords.
-/* { dg-options "-std=gnu99" } */
-
/* C99 6.8.5.2: The for statement. */
#include <stdio.h>
#include <stdlib.h>
+#include "dfp-dbg.h"
void
f32 (void)
i++;
if (i != 5)
- abort();
+ FAILURE
}
void
i++;
if (i != 5)
- abort();
+ FAILURE
}
void
i++;
if (i != 5)
- abort();
+ FAILURE
}
int
f64 ();
f128 ();
+ FINISH
return (0);
}
/* { dg-do compile } */
-/* { dg-options "-std=gnu99" } */
typedef float decimal32 __attribute__ ((mode (SD)));
typedef float decimal64 __attribute__ ((mode (DD)));
-/* { dg-options "-std=gnu99" } */
-
/* 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. */
-extern void abort (void);
+#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(""))
- abort();
+ FAILURE
if (__builtin_nand64("") == __builtin_nand64(""))
- abort();
+ FAILURE
if (__builtin_nand128("") == __builtin_nand128(""))
- abort();
+ FAILURE
if (!(__builtin_nand32("") != __builtin_nand32("")))
- abort();
+ FAILURE
if (!(__builtin_nand64("") != __builtin_nand64("")))
- abort();
+ FAILURE
if (!(__builtin_nand128("") != __builtin_nand128("")))
- abort();
+ FAILURE
if (__builtin_nand32("") > __builtin_nand32(""))
- abort();
+ FAILURE
if (__builtin_nand64("") >= __builtin_nand64(""))
- abort();
+ FAILURE
if (__builtin_nand128("") < __builtin_nand128(""))
- abort();
+ FAILURE
if (-__builtin_nand128("") < +__builtin_nand128(""))
- abort();
+ FAILURE
/* 0.0/0.0 => NaN, but NaN != NaN. */
if (0.0df/0.0dl == __builtin_nand32(""))
- abort();
+ FAILURE
/* 0.0 * INF => NaN. */
if (!__builtin_isnand32 (0.0df * __builtin_infd32()))
- abort ();
+ FAILURE
if (!__builtin_isnand64 (0.0dd * __builtin_infd64()))
- abort ();
+ FAILURE
if (!__builtin_isnand128 (0.0dd * __builtin_infd128()))
- abort ();
+ FAILURE
/* INF - INF => NaN. */
if (!__builtin_isnand32 (__builtin_infd32() - __builtin_infd32()))
- abort ();
+ FAILURE
if (!__builtin_isnand64 (__builtin_infd64() - __builtin_infd64()))
- abort ();
+ FAILURE
if (!__builtin_isnand128 (__builtin_infd128() - __builtin_infd128()))
- abort ();
+ FAILURE
/* INF/INF => NaN. */
if (!__builtin_isnand32 (__builtin_infd32()/__builtin_infd32()) )
- abort ();
+ FAILURE
if (!__builtin_isnand64 (__builtin_infd64()/__builtin_infd64()) )
- abort ();
+ FAILURE
if (!__builtin_isnand128 (__builtin_infd128()/__builtin_infd128()) )
- abort ();
+ FAILURE
/* 0.0/0.0 => NaN, but NaN != NaN. */
if ((0.0dd/0.0df) == (0.0dd/0.0df))
- abort();
+ FAILURE
if (__builtin_nand32("") < __builtin_infd32())
- abort();
+ FAILURE
if (__builtin_nand32("") >= __builtin_infd32())
- abort();
+ FAILURE
/* Fixme: Add sqrtdf(-x.df) test when sqrt is supported. */
if (!__builtin_isnand32(__builtin_nand32("")))
- abort();
+ FAILURE
if (!__builtin_isnand64(__builtin_nand64("")))
- abort();
+ FAILURE
if (!__builtin_isnand128(__builtin_nand128("")))
- abort();
+ FAILURE
if (!__builtin_isnand128(8.0df * __builtin_nand128("")))
- abort();
+ FAILURE
if (!__builtin_isnand32(8.1dl - __builtin_nand32("")))
- abort();
+ FAILURE
if (!__builtin_isnand128(__builtin_nand64("") + __builtin_nand128("")))
- abort();
+ FAILURE
- return 0;
+ FINISH
}
-/* { dg-options "-std=gnu99" } */
-
/* 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. */
-extern void abort (void);
+#include "dfp-dbg.h"
int main()
{
result. */
d32 = 123.45f;
if (d32/-0.0df != -__builtin_infd32())
- abort();
+ FAILURE
if (123.45df/-0.0df != -__builtin_infd32())
- abort();
+ FAILURE
d64 = 123.45f;
if (d64/-0.0dd != -__builtin_infd64())
- abort();
+ FAILURE
if (123.45dd/-0.0dd != -__builtin_infd64())
- abort();
+ FAILURE
d128 = 123.45f;
if (d128/-0.0dl != -__builtin_infd64())
- abort();
+ FAILURE
if (123.45dl/-0.0dl != -__builtin_infd128())
- abort();
+ FAILURE
d32 = 0.0df;
if (!__builtin_isnand32(-(d32/-0.0df)))
- abort();
+ FAILURE
if (!__builtin_isnand32(-(0.0df/-0.0df)))
- abort();
+ FAILURE
d64 = 0.0dd;
if (!__builtin_isnand64(-(d64/-0.0dd)))
- abort();
+ FAILURE
if (!__builtin_isnand64(-(0.0dd/-0.0dd)))
- abort();
+ FAILURE
d128 = 0.0dl;
if (!__builtin_isnand128(-(d128/-0.0dl)))
- abort();
+ FAILURE
if (!__builtin_isnand128(-(0.0dl/-0.0dl)))
- abort();
+ FAILURE
- return 0;
+ FINISH
}
-/* { dg-options "-std=gnu99 -O2" } */
+/* { dg-options "-O2" } */
/* C99 6.5.5: Multiplicative operators.
C99 6.5.6: Additive operators. */
-/* { dg-options "-std=gnu99" } */
-
/* 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. */
-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
+#include "dfp-dbg.h"
#define OPERATE(OPRD1,OPRT,OPRD2,RLT) \
if (( OPRD1 OPRT OPRD2 )!= RLT) \
DECIMAL_COMPOUND_ASSIGNMENT(64, d64);
DECIMAL_COMPOUND_ASSIGNMENT(128, d128);
- if (failcnt != 0)
- abort ();
-
- return 0;
+ FINISH
}
/* { dg-do compile } */
-/* { dg-options "-std=gnu99" } */
/* C99 6.5.10: Bitwise AND operator.
C99 6.5.11: Bitwise exclusive OR operator.
Test that these operators do not accept decimal float operands. */
-extern void abort (void);
-
#define OPERATE(OPRD1,OPRT,OPRD2) \
do \
{ \
-/* { dg-options "-std=gnu99 -O0" } */
+/* { dg-options "-O0" } */
/* C99 6.5.17: Comma operator.
Test with decimal float operands. */
-extern void abort (void);
-static int failcnt = 0;
-
-/* 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
+#include "dfp-dbg.h"
volatile _Decimal32 d32a, d32b, d32c;
volatile _Decimal64 d64a, d64b, d64c;
if (d64a != 12.0dd)
FAILURE;
- return 0;
+ FINISH
}
-/* { dg-options "-std=gnu99 -O0" } */
+/* { dg-options "-O0" } */
/* C99 6.5.15 Conditional operator.
Test with decimal float operands. */
-extern void abort (void);
-static int failcnt = 0;
-
-/* 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
+#include "dfp-dbg.h"
volatile _Decimal32 d32a, d32b, d32c;
volatile _Decimal64 d64a, d64b, d64c;
if (d128a != d128b)
FAILURE
- return 0;
+ FINISH
}
-/* { dg-options "-std=gnu99" } */
-
/* C99 Logical AND operator.
C99 Logical OR operator.
Test with decimal float operands. */
-extern void abort (void);
+#include "dfp-dbg.h"
#define OPERATE(OPRD1,OPRT,OPRD2,RLT) \
do \
{ \
if (( (OPRD1) OPRT (OPRD2) )!= RLT) \
- abort (); \
+ __builtin_abort (); \
} while (0)
#define DECIMAL_LOGICAL_OR(OPRD) \
-/* { dg-options "-std=gnu99" } */
-
/* C99 6.5.3 Unary operators. */
-extern void abort (void);
+#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++) abort (); \
- if (--in_de_d##TYPE) abort (); \
- if (++in_de_d##TYPE == 0.0##SUFFIX) abort (); \
- if (in_de_d##TYPE-- == 0.0##SUFFIX) abort (); \
+ _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_d##TYPE = 1.0##SUFFIX; \
_Decimal##TYPE* unary_dp##TYPE; \
/* & operator. */ \
unary_dp##TYPE = &(unary_d##TYPE); \
unary_d##TYPE = *(unary_dp##TYPE); \
/* - operator. */ \
unary_d##TYPE = -unary_d##TYPE; \
- if (unary_d##TYPE != -1.0##SUFFIX) abort (); \
+ if (unary_d##TYPE != -1.0##SUFFIX) FAILURE \
/* + operator. */ \
unary_d##TYPE = +unary_d##TYPE; \
- if (unary_d##TYPE != -1.0##SUFFIX) abort (); \
- if (!unary_d##TYPE) abort (); /*! operator. */ \
+ if (unary_d##TYPE != -1.0##SUFFIX) FAILURE \
+ if (!unary_d##TYPE) FAILURE /*! operator. */ \
} while (0)
int
UNARY_OPERATOR(128, DL);
/* C99 6.5.3 Unary operators for zero values. */
- if (- +0.df != -0.df) abort ();
- if (+ -0.df != -0.df) abort ();
- if (- -0.df != +0.df) abort ();
+ if (- +0.df != -0.df) FAILURE
+ if (+ -0.df != -0.df) FAILURE
+ if (- -0.df != +0.df) FAILURE
- return 0;
+ FINISH
}
/* { dg-do compile } */
-/* { dg-options "-O -std=gnu99 -mtune=i386" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
-/* { dg-options "-O -std=gnu99" } */
+/* { dg-options "-O -mtune=i386" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+/* { dg-options "-O" } */
typedef struct
{
/* { dg-do compile } */
-/* { dg-options "-std=gnu99 -O2" } */
+/* { dg-options "-O2" } */
typedef _Decimal32 fp_t;
/* { dg-do compile } */
-/* { dg-options "-std=gnu99" } */
/* The suffix for a decimal float constant must use a single case.
/* { dg-do compile } */
-/* { dg-options "-std=gnu99 -O2" } */
+/* { dg-options "-O2" } */
extern void foo (_Decimal32);
_Decimal32 *p;
/* { dg-do run } */
-/* { dg-options "-std=gnu99" } */
#include <stdarg.h>
-extern void abort (void);
+#include "dfp-dbg.h"
void
f (int a, ...)
{
va_list ap;
if (a != 0)
- abort ();
+ FAILURE
va_start (ap, a);
if (va_arg (ap, _Decimal128) != 1.2DL)
- abort ();
+ FAILURE
if (va_arg (ap, _Decimal128) != 2.34DL)
- abort ();
+ FAILURE
if (va_arg (ap, _Decimal128) != 3.456DL)
- abort ();
+ FAILURE
if (va_arg (ap, _Decimal128) != 4.567DL)
- abort ();
+ FAILURE
if (va_arg (ap, double) != 5.125)
- abort ();
+ FAILURE
va_end (ap);
}
main (void)
{
f (0, 1.2DL, 2.34DL, 3.456DL, 4.567DL, 5.125);
- return 0;
+
+ FINISH
}
/* { dg-do compile { target fpic } } */
-/* { dg-options "-std=gnu99 -O2 -fPIC" } */
+/* { dg-options "-O2 -fPIC" } */
volatile _Decimal32 d;
volatile int i;
/* { dg-do run } */
-/* { dg-options "-std=gnu99 -O" } */
+/* { dg-options "-O" } */
/* DFP TR 24732 == WG14 / N1176, N1312 */
/* Based on a test from Fred Tydeman. */
-extern void abort (void);
-int failures = 0;
-
-#ifdef DBG
-#include <stdio.h>
-#define FAILURE(MSG) { printf ("line %d: %s\n", __LINE__, MSG); failures++; }
-#else
-#define FAILURE(MSG) failures++;
-#endif
-
+#include "dfp-dbg.h"
/* Test runtime computations. */
_Decimal32 d32 = (float)((v1/v2-v3) - (v4/v5-v6));
if (b32)
- FAILURE ("runtime: b32 should be zero")
+ FAILURE
if (d32)
- FAILURE ("runtime: d32 should be zero")
+ FAILURE
}
void
_Decimal64 d64 = (double)((v1/v2-v3) - (v4/v5-v6));
if (b64)
- FAILURE ("runtime: b64 should be zero")
+ FAILURE
if (d64)
- FAILURE ("runtime: d64 should be zero")
+ FAILURE
}
void
_Decimal128 d128 = (long double)((v1/v2-v3) - (v4/v5-v6));
if (b128)
- FAILURE ("runtime: b128 should be zero")
+ FAILURE
if (d128)
- FAILURE ("runtime: d128 should be zero")
+ FAILURE
}
/* Test constant folding. */
_Decimal32 b32 = (float)((28.f/3.f-9.f) - (31.f/3.f-10.f));
if (b32)
- FAILURE ("fold: b32 should be zero")
+ FAILURE
if (d32)
- FAILURE ("fold: d32 should be zero")
+ FAILURE
}
void
_Decimal64 d64 = (double)((28./3.-9.) - (31./3.-10.));
if (b64)
- FAILURE ("fold: b64 should be zero")
+ FAILURE
if (d64)
- FAILURE ("fold: d64 should be zero")
+ FAILURE
}
void
_Decimal128 d128 = (long double)((28./3.-9.) - (31./3.-10.));
if (b128)
- FAILURE ("fold: b128 should be zero")
+ FAILURE
if (d128)
- FAILURE ("fold: d128 should be zero")
+ FAILURE
}
int
fold64 ();
fold128 ();
- if (failures != 0)
- abort ();
- return 0;
+ FINISH
}
/* { dg-do run } */
-/* { dg-options "-std=gnu99 -O" } */
+/* { dg-options "-O" } */
/* DFP TR 24732 == WG14 / N1176, N1312 */
/* Based on a test from Fred Tydeman. */
-extern void abort (void);
-int failures = 0;
-
-#ifdef DBG
-#include <stdio.h>
-#define FAILURE(MSG) { printf ("line %d: %s\n", __LINE__, MSG); failures++; }
-#else
-#define FAILURE(MSG) failures++;
-#endif
+#include "dfp-dbg.h"
/* Test runtime computations. */
volatile _Decimal32 d;
d = 0.0DF;
if (d)
- FAILURE ("0.0DF should be zero")
+ FAILURE
}
void
volatile _Decimal64 d;
d = 0.0DD;
if (d)
- FAILURE ("0.0DD should be zero")
+ FAILURE
}
void
volatile _Decimal128 d;
d = 0.0DL;
if (d)
- FAILURE ("0.0DL should be zero")
+ FAILURE
}
void
fold32 (void)
{
if (0.0DF)
- FAILURE ("0.0DF should be zero")
+ FAILURE
}
void
fold64 (void)
{
if (0.0DD)
- FAILURE ("0.0DD should be zero")
+ FAILURE
}
void
fold128 (void)
{
if (0.0DL)
- FAILURE ("0.0DL should be zero")
+ FAILURE
}
int
fold64 ();
fold128 ();
- if (failures != 0)
- abort ();
- return 0;
+ FINISH
}
-/* { dg-options "--std=gnu99" } */
-
/* 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. */
-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
+#include "dfp-dbg.h"
#define COMPARE32(A,B) \
A.i == B.i
doit64 ();
doit128 ();
- if (failcnt != 0)
- abort ();
-
- return 0;
+ FINISH
}
/* { dg-do compile } */
-/* { dg-options "-std=gnu99" } */
/* Check that the compiler generates the correct decimal float constants. */
/* { dg-do compile } */
-/* { dg-options "-std=gnu99 -Wall" } */
+/* { dg-options "-Wall" } */
/* N1312 7.1.1: The FLOAT_CONST_DECIMAL64 pragma.
C99 6.4.4.2a (New).
/* { dg-do compile } */
-/* { dg-options "-std=gnu99 -Wall" } */
+/* { dg-options "-Wall" } */
/* N1312 7.1.1: The FLOAT_CONST_DECIMAL64 pragma.
C99 6.4.4.2a (New).
/* { dg-do compile } */
-/* { dg-options "-std=gnu99 -Wall" } */
+/* { dg-options "-Wall" } */
/* N1312 7.1.1: The FLOAT_CONST_DECIMAL64 pragma.
C99 6.4.4.2a (New). */
/* { dg-do compile } */
-/* { dg-options "-std=gnu99" } */
/* N1312 7.1.1: The FLOAT_CONST_DECIMAL64 pragma.
C99 6.4.4.2a (New).
/* { dg-do compile } */
-/* { dg-options "-std=gnu99 -Wall" } */
+/* { dg-options "-Wall" } */
/* N1312 7.1.1: The FLOAT_CONST_DECIMAL64 pragma.
C99 6.4.4.2a (New).
/* { dg-do compile } */
-/* { dg-options "-std=gnu99 -Wall" } */
+/* { dg-options "-Wall" } */
/* N1312 7.1.1: The FLOAT_CONST_DECIMAL64 pragma.
C99 6.4.4.2a (New).
-/* { dg-options "-O0 -std=gnu99" } */
+/* { dg-options "-O0" } */
/* Decimal float versions of __builtin_signbit. */
-extern void abort (void);
-int failures;
-
-#ifdef DBG
-extern int printf (const char *, ...);
-#define FAILURE { printf ("failed at line %d\n", __LINE__); failures++; }
-#else
-#define FAILURE abort ();
-#endif
+#include "dfp-dbg.h"
#define CHECK32(D,I) \
if ((__builtin_signbitd32 (D) != 0) != I) FAILURE
td = 0.0dl; CHECK128 (td, 0)
td = -0.0dl; CHECK128 (td, 1)
- if (failures != 0)
- abort ();
- return 0;
+ FINISH
}
-/* { dg-options "-O0 -std=gnu99" } */
+/* { dg-options "-O0" } */
/* Check that the compiler uses builtins for signbit; if not the link
will fail because library functions are in libm. */
-extern void abort (void);
+#include "dfp-dbg.h"
volatile _Decimal32 sd = 2.3df;
volatile _Decimal64 dd = -4.5dd;
int
main ()
{
- if (signbitf (f) != 0) abort ();
- if (signbit (d) == 0) abort ();
- if (signbitl (ld) != 0) abort ();
- if (signbitd32 (sd) != 0) abort ();
- if (signbitd64 (dd) == 0) abort ();
- if (signbitd128 (tf) != 0) abort ();
+ 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
- return 0;
+ FINISH
}
-/* { dg-options "-std=gnu99" } */
-
#include <stdarg.h>
-
-extern void abort (void);
+#include "dfp-dbg.h"
struct S1
{
} a;
};
-static int failcnt = 0;
-
-/* 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 do \
-{ printf ("failed at line %d\n", __LINE__); \
- failcnt++; \
-}while(0)
-#else
-#define FAILURE abort ()
-#endif
-
int check_var (int z, ...)
{
long long result;
if (check_var (2, s5, 2LL) == 0)
FAILURE;
- if (failcnt)
- abort ();
-
- return 0;
+ FINISH
}
/* Test for valid and invalid combinations of type specifiers.
Based off gcc.dg/test-spec-1.c */
/* { dg-do compile } */
-/* { dg-options "-std=gnu99" } */
typedef char type;
void _Decimal32 *x0; /* { dg-error "" "void _Decimal32" } */
-/* { dg-options "-std=gnu99" } */
-
/* Cast to union is a GNU C extension. */
-extern void abort (void);
+#include "dfp-dbg.h"
union u
{
double d;
if (u1.d128 != 0.0dl)
- abort ();
+ FAILURE
if (u2.d128 != 4.2dl)
- abort ();
+ FAILURE
/* cast decimal floating point to union type. */
d128 = 1.23dl;
u4 = (union u) d128;
if (u4.d128 != 1.23dl)
- abort ();
+ FAILURE
u4 = (union u) d;
if (u4.d != 3.25)
- abort ();
+ FAILURE
n1 = (union n) d64;
if (n1.d64 != 4.56dd)
- abort ();
+ FAILURE
n1 = (union n)d;
if (n1.d != 3.25)
- abort ();
+ FAILURE
- return 0;
+ FINISH
}
/* { dg-do compile } */
-/* { dg-options "-std=gnu99" } */
/* This used to result in an ICE. */
/* { dg-do compile } */
-/* { dg-options "-std=gnu99" } */
/* N1150 5.4: Usual arithmetic conversions.
C99 6.3.1.8[1] (New).
/* { dg-do compile } */
-/* { dg-options "-std=gnu99" } */
/* Test various conversions involving decimal floating types. */
-/* { dg-options "-std=gnu99 -O0" } */
+/* { 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. */
-extern void abort (void);
-static int failcnt = 0;
-
-/* 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
+#include "dfp-dbg.h"
volatile _Decimal32 d32a, d32b, d32c;
volatile _Decimal64 d64a, d64b, d64c;
if (d128a != d128c / 2.0dl)
FAILURE
- return 0;
+ FINISH
}
Based on gcc.dg/wtr-conversion-1.c */
/* { dg-do compile } */
-/* { dg-options "-std=gnu99 -Wtraditional" } */
+/* { dg-options "-Wtraditional" } */
extern void foo_i (int);
extern void foo_f (float);