1 /* { dg-do compile { target c99_runtime } } */
2 /* { dg-options "-Wabsolute-value" } */
10 tst_unsigned (unsigned *pu
, unsigned long *pl
, unsigned long long *pll
,
13 *pu
= abs (*pu
); /* { dg-warning "taking the absolute value of unsigned type" } */
14 *pl
= labs (*pl
); /* { dg-warning "taking the absolute value of unsigned type" } */
15 *pll
= llabs (*pll
); /* { dg-warning "taking the absolute value of unsigned type" } */
16 *pm
= imaxabs (*pm
); /* { dg-warning "taking the absolute value of unsigned type" } */
20 test_int_size (long long *pll
)
22 *pll
= abs (*pll
); /* { dg-warning "may cause truncation of value" } */
23 *pll
= abs ((int) *pll
);
27 tst_notint (float *pf
, double *pd
, _Complex
double *pc
)
29 *pf
= abs (*pf
); /* { dg-warning "using integer absolute value function" } */
30 *pd
= labs (*pd
); /* { dg-warning "using integer absolute value function" } */
31 *pc
= abs (*pc
); /* { dg-warning "using integer absolute value function" } */
35 tst_notfloat (int *pi
, long *pl
, complex double *pc
)
37 *pi
= fabsf (*pi
); /* { dg-warning "using floating-point absolute value function" } */
38 *pl
= fabs (*pl
); /* { dg-warning "using floating-point absolute value function" } */
39 *pc
= fabs (*pc
); /* { dg-warning "using floating-point absolute value function" } */
43 tst_float_size (double *pd
, long double *pld
)
45 *pd
= fabsf (*pd
); /* { dg-warning "may cause truncation of value" } */
46 *pld
= fabs (*pld
); /* { dg-warning "may cause truncation of value" "fabs trunc" { target { large_long_double } } } */
47 *pld
= fabs ((double) *pld
);
50 void tst_notcomplex (int *pi
, long *pl
, long double *pld
)
52 *pi
= cabs (*pi
); /* { dg-warning "using complex absolute value function" } */
53 *pl
= cabs (*pl
); /* { dg-warning "using complex absolute value function" } */
54 *pld
= cabsl (*pld
);/* { dg-warning "using complex absolute value function" } */
57 void tst_cplx_size (complex double *pcd
, complex long double *pcld
)
59 *pcd
= cabsf (*pcd
); /* { dg-warning "may cause truncation of value" } */
60 *pcld
= cabs (*pcld
); /* { dg-warning "may cause truncation of value" "cabs trunc" { target { large_long_double } } } */
61 *pcld
= cabs ((complex double) *pcld
);