File: builtin-tgmath-dfp-err.c

package info (click to toggle)
gcc-riscv64-unknown-elf 8.3.0.2019.08%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 680,956 kB
  • sloc: ansic: 3,237,715; cpp: 896,882; ada: 772,854; f90: 144,254; asm: 68,788; makefile: 67,456; sh: 29,743; exp: 28,045; objc: 15,273; fortran: 11,885; python: 7,369; pascal: 5,375; awk: 3,725; perl: 2,872; yacc: 316; xml: 311; ml: 285; lex: 198; haskell: 122
file content (33 lines) | stat: -rw-r--r-- 1,746 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* Test __builtin_tgmath: errors that indicate bad arguments in a call
   to a type-generic macro, DFP involved.  */
/* { dg-do compile } */
/* { dg-options "" } */

float f_f (float);
double f_d (double);
long double f_ld (long double);
_Complex float f_cf (_Complex float);
_Complex double f_cd (_Complex double);
_Complex long double f_cld (_Complex long double);
_Decimal32 f_d32 (_Decimal32);
_Decimal64 f_d64 (_Decimal64);
_Decimal128 f_d128 (_Decimal128);
float f_ff (float, float);
_Complex float f_cfcf (_Complex float, _Complex float);
_Decimal32 f_d32d32 (_Decimal32, _Decimal32);
_Complex float cf;
float f;
_Decimal32 d32;

void
test (void)
{
  __builtin_tgmath (f_cf, f_cd, f_cld, d32); /* { dg-error "decimal floating-point argument 1 to complex-only type-generic function" } */
  __builtin_tgmath (f_f, f_d, f_ld, d32); /* { dg-error "decimal floating-point argument 1 to binary-only type-generic function" } */
  __builtin_tgmath (f_cfcf, f_d32d32, cf, d32); /* { dg-error "both complex and decimal floating-point arguments to type-generic function" } */
  __builtin_tgmath (f_ff, f_d32d32, f, d32); /* { dg-error "both binary and decimal floating-point arguments to type-generic function" } */
  __builtin_tgmath (f_d32, f_d64, f_d128, cf); /* { dg-error "complex argument 1 to decimal-only type-generic function" } */
  __builtin_tgmath (f_d32, f_d64, f_d128, f); /* { dg-error "binary argument 1 to decimal-only type-generic function" } */
  __builtin_tgmath (f_cfcf, f_d32d32, d32, cf); /* { dg-error "both complex and decimal floating-point arguments to type-generic function" } */
  __builtin_tgmath (f_ff, f_d32d32, d32, f); /* { dg-error "both binary and decimal floating-point arguments to type-generic function" } */
}