AArch64: correct constraint on Upl early clobber alternatives
[official-gcc.git] / gcc / testsuite / gfortran.dg / mod_sign0_1.f90
blob369296abac82e15a29ab7863523e1882bb44c001
1 ! { dg-do run }
2 ! PR fortran/49010
3 ! MOD/MODULO sign of zero.
5 ! We wish to provide the following guarantees:
7 ! MOD(A, P): The result has the sign of A and a magnitude less than
8 ! that of P.
10 ! MODULO(A, P): The result has the sign of P and a magnitude less than
11 ! that of P.
13 ! Here we test only with constant arguments (evaluated with
14 ! mpfr_fmod), as we don't want to cause failures on targets with a
15 ! crappy libm. But, a target where fmod follows C99 Annex F is
16 ! fine. Also, targets where GCC inline expands fmod (such as x86(-64))
17 ! are also fine.
18 program mod_sign0_1
19 implicit none
20 real :: r, t
22 r = mod (4., 2.)
23 t = sign (1., r)
24 if (t < 0.) STOP 1
26 r = modulo (4., 2.)
27 t = sign (1., r)
28 if (t < 0.) STOP 2
30 r = mod (-4., 2.)
31 t = sign (1., r)
32 if (t > 0.) STOP 3
34 r = modulo (-4., 2.)
35 t = sign (1., r)
36 if (t < 0.) STOP 4
38 r = mod (4., -2.)
39 t = sign (1., r)
40 if (t < 0.) STOP 5
42 r = modulo (4., -2.)
43 t = sign (1., r)
44 if (t > 0.) STOP 6
46 r = mod (-4., -2.)
47 t = sign (1., r)
48 if (t > 0.) STOP 7
50 r = modulo (-4., -2.)
51 t = sign (1., r)
52 if (t > 0.) STOP 8
54 end program mod_sign0_1