File: usual-arith-conv-bad.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 (49 lines) | stat: -rw-r--r-- 2,188 bytes parent folder | download | duplicates (10)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/* { dg-do compile } */

/* N1150 5.4: Usual arithmetic conversions.
   C99 6.3.1.8[1] (New).

   Test arithmetic operators between decimal float types and generic
   float types, which are not allowed.  */

extern _Decimal32 d32a, d32b;
extern _Decimal64 d64a, d64b;
extern _Decimal128 d128a, d128b;
extern float f;
extern double d;
extern long double ld;

extern signed int __attribute__ ((vector_size (16))) vi;

extern _Complex float cf;
extern _Complex double cd;
extern _Complex long double cld;
extern _Complex int ci;

void
foo (void)
{
  /* Mixed operations with decimal and generic float operands.  */
  d32a = d32b + f;	/* { dg-error "" "error.*mix operands of decimal float" } */
  d32a = f * d32b;	/* { dg-error "" "error.* mix operands of decimal float" } */
  d32a *= f;		/* { dg-error "" "error.* mix operands of decimal float" } */
  f += d32b;		/* { dg-error "" "error.* mix operands of decimal float" } */
  d64a = d32a + d;	/* { dg-error "" "error.* mix operands of decimal float" } */
  d64a = d * d128a;	/* { dg-error "" "error.* mix operands of decimal float" } */
  d64a -= d;		/* { dg-error "" "error.* mix operands of decimal float" } */
  d128a = ld * d128b;	/* { dg-error "" "error.* mix operands of decimal float" } */
  d128a = d64b + d;	/* { dg-error "" "error.* mix operands of decimal float" } */
  d128a *= f;		/* { dg-error "" "error.* mix operands of decimal float" } */

  /* Mixed operations with decimal float and a vector type.  */
  d64a = d64b + vi;	/* { dg-error "" "error.* mix operands of decimal float" } */
  d32a *= vi;		/* { dg-error "" "error.* mix operands of decimal float" } */
  d128a = vi - d128b;	/* { dg-error "" "error.* mix operands of decimal float" } */

  /* Mixed operations with decimal float and Complex types.  */
  d32a += ci;		/* { dg-error "" "error.* mix operands of decimal float" } */
  d64a = ci * d32a;	/* { dg-error "" "error.* mix operands of decimal float" } */
  cd = d64a * cd;	/* { dg-error "" "error.* mix operands of decimal float" } */
  d128b = cld * d128b;	/* { dg-error "" "error.* mix operands of decimal float" } */
  d32a = cf * d32b;	/* { dg-error "" "error.* mix operands of decimal float" } */
}