Debian Codegraph @

gcc/testsuite/gfortran.dg/boz_3.f90

raw
1 ! { dg-do run }
2 ! { dg-options "-std=gnu -fallow-invalid-boz" }
3 !
4 ! Test that the BOZ constant on the RHS, which are of different KIND than
5 ! the LHS, are correctly converted.
6 !
7 program boz
8
9 implicit none
10
11 integer(1), parameter :: &
12 & b1 = b'000000000001111' ! { dg-warning "BOZ literal constant at" }
13 integer(2), parameter :: &
14 & b2 = b'00000000000000000111000011110000' ! { dg-warning "BOZ literal constant at" }
15 integer(4), parameter :: &
16 & b4 = b'0000000000000000000000000000000001110000111100001111000011110000' ! { dg-warning "BOZ literal constant at" }
17
18 integer(1), parameter :: o1 = o'0012' ! { dg-warning "BOZ literal constant at" }
19 integer(2), parameter :: o2 = o'0004321' ! { dg-warning "BOZ literal constant at" }
20 integer(4), parameter :: o4 = o'0000000043210765' ! { dg-warning "BOZ literal constant at" }
21
22 integer(1), parameter :: z1 = z'0a' ! { dg-warning "BOZ literal constant at" }
23 integer(2), parameter :: z2 = z'00ab' ! { dg-warning "BOZ literal constant at" }
24 integer(4), parameter :: z4 = z'0000dead' ! { dg-warning "BOZ literal constant at" }
25
26 if (b1 /= 15_1) STOP 1
27 if (b2 /= 28912_2) STOP 2
28 if (b4 /= 1894838512_4) STOP 3
29
30 if (o1 /= 10_1) STOP 4
31 if (o2 /= 2257_2) STOP 5
32 if (o4 /= 9245173_4) STOP 6
33
34 if (z1 /= 10_1) STOP 7
35 if (z2 /= 171_2) STOP 8
36 if (z4 /= 57005_4) STOP 9
37
38 end program boz