ieee_9.f90: XFAIL on arm*-*-gnueabi[hf].
[official-gcc.git] / gcc / testsuite / gfortran.dg / dec_structure_22.f90
blobb2767b3dc642e8d906a0084ac44a49cbfba2b69c
1 ! { dg-do run }
2 ! { dg-options "-fdec-structure" }
4 ! PR fortran/82511
6 ! Verify that structure variables with UNION components
7 ! are accepted in an I/O-list READ.
9 implicit none
11 structure /s/
12 union
13 map
14 character(16) :: c16_1
15 end map
16 map
17 character(16) :: c16_2
18 end map
19 end union
20 end structure
22 record /s/ r
23 character(32) :: instr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^"
25 r.c16_1 = ' '
26 r.c16_2 = ' '
27 ! The record r shall be treated as if its components are listed:
28 ! read(...) r.c16_1, r.c16_2
29 ! This shall correspond to the formatted read of A16,A16
30 read(instr, '(A16,A16)') r
32 ! r.c16_1 and r.c16_2 are in a union, thus share the same memory
33 ! and the first 16 bytes of instr are overwritten
34 if ( r.c16_1 .ne. instr(17:32) .or. r.c16_2 .ne. instr(17:32) ) then
35 STOP 1
36 endif
38 end