1 /* { dg-do compile } */
2 /* { dg-options "-Wabsolute-value" } */
3 
4 #include <stdlib.h>
5 #include <complex.h>
6 #include <math.h>
7 
tst_decimal(_Decimal32 * p32,_Decimal64 * p64,_Decimal128 * p128)8 void tst_decimal (_Decimal32 *p32, _Decimal64 *p64, _Decimal128 *p128)
9 {
10   *p32 = abs(*p32);       /* { dg-warning "using integer absolute value function" } */
11   *p64 = fabs(*p64);      /* { dg-warning "using floating-point absolute value function" } */
12   *p128 = cabsl(*p128);   /* { dg-warning "using complex absolute value function" } */
13 }
14 
tst_notdecimal(int * pi,double * pd,long double * pld,complex double * pc)15 void tst_notdecimal (int *pi, double *pd, long double *pld, complex double *pc)
16 {
17   *pi = __builtin_fabsd32 (*pi);   /* { dg-warning "using decimal floating-point absolute value function" } */
18   *pd = __builtin_fabsd64 (*pd);   /* { dg-warning "using decimal floating-point absolute value function" } */
19   *pld = __builtin_fabsd64 (*pld); /* { dg-warning "using decimal floating-point absolute value function" } */
20   *pc = __builtin_fabsd128 (*pc);  /* { dg-warning "using decimal floating-point absolute value function" } */
21 }
22 
23 void
test_size(_Decimal64 * p64,_Decimal128 * p128)24 test_size  (_Decimal64 *p64, _Decimal128 *p128)
25 {
26   *p64 = __builtin_fabsd32 (*p64);   /* { dg-warning "may cause truncation of value" } */
27   *p128 = __builtin_fabsd64 (*p128); /* { dg-warning "may cause truncation of value" } */
28 }
29