1! { dg-do compile }
2! { dg-options "-fdec-structure" }
3!
4! PR fortran/77782
5!
6! Test an ICE where a union might be considered equal to a structure,
7! causing the union's backend_decl to be replaced with that of the structure.
8!
9
10program p
11
12structure /s1/
13  union
14    map
15      integer(4) a
16      end map
17    map
18      real(4) b
19    end map
20  end union
21end structure
22
23structure /s2/
24  union ! regression: if this union == s1, we ICE in gfc_get_union_type
25    map
26      integer(2) x, y
27      integer(4) z
28    end map
29  end union
30end structure
31
32record /s1/ r1
33r1.a = 0
34
35end
36