! RUN: bbc --strict-fir-volatile-verifier %s -o - | FileCheck %s ! Requires correct propagation of volatility for allocatable nested types. function allocatable_udt() type :: base_type integer :: i = 42 end type type, extends(base_type) :: ext_type integer :: j = 100 end type integer :: allocatable_udt type(ext_type), allocatable, volatile :: v2(:,:) allocate(v2(2,3)) allocatable_udt = v2(1,1)%i end function ! CHECK-LABEL: func.func @_QPallocatable_udt() -> i32 { ! CHECK: %{{.+}}:2 = hlfir.declare %{{.+}} typeparams %{{.+}} {fortran_attrs = #fir.var_attrs, uniq_name = "_QFallocatable_udtE.n.i"} : (!fir.ref>, index) -> (!fir.ref>, !fir.ref>) ! CHECK: %{{.+}}:2 = hlfir.declare %{{.+}} {fortran_attrs = #fir.var_attrs, uniq_name = "_QFallocatable_udtE.di.base_type.i"} : (!fir.ref) -> (!fir.ref, !fir.ref) ! CHECK: %{{.+}}:2 = hlfir.declare %{{.+}} typeparams %{{.+}} {fortran_attrs = #fir.var_attrs, uniq_name = "_QFallocatable_udtE.n.base_type"} : (!fir.ref>, index) -> (!fir.ref>, !fir.ref>) ! CHECK: %{{.+}}:2 = hlfir.declare %{{.+}} typeparams %{{.+}} {fortran_attrs = #fir.var_attrs, uniq_name = "_QFallocatable_udtE.n.j"} : (!fir.ref>, index) -> (!fir.ref>, !fir.ref>) ! CHECK: %{{.+}}:2 = hlfir.declare %{{.+}} {fortran_attrs = #fir.var_attrs, uniq_name = "_QFallocatable_udtE.di.ext_type.j"} : (!fir.ref) -> (!fir.ref, !fir.ref) ! CHECK: %{{.+}}:2 = hlfir.declare %{{.+}} typeparams %{{.+}} {fortran_attrs = #fir.var_attrs, uniq_name = "_QFallocatable_udtE.n.ext_type"} : (!fir.ref>, index) -> (!fir.ref>, !fir.ref>) ! CHECK: %{{.+}}:2 = hlfir.declare %{{.+}} {uniq_name = "_QFallocatable_udtEallocatable_udt"} : (!fir.ref) -> (!fir.ref, !fir.ref) ! CHECK: %{{.+}}:2 = hlfir.declare %{{.+}} {fortran_attrs = #fir.var_attrs, uniq_name = "_QFallocatable_udtEv2"} : (!fir.ref>>, volatile>, volatile>) -> (!fir.ref>>, volatile>, volatile>, !fir.ref>>, volatile>, volatile>) ! CHECK: %{{.+}}:2 = hlfir.declare %{{.+}}(%{{.+}}) {fortran_attrs = #fir.var_attrs, uniq_name = "_QFallocatable_udtE.c.base_type"} : (!fir.ref>>, !fir.shapeshift<1>) -> (!fir.box>>, !fir.ref>>) ! CHECK: %{{.+}}:2 = hlfir.declare %{{.+}} {fortran_attrs = #fir.var_attrs, uniq_name = "_QFallocatable_udtE.dt.base_type"} : (!fir.ref>) -> (!fir.ref>, !fir.ref>) ! CHECK: %{{.+}}:2 = hlfir.declare %{{.+}} {fortran_attrs = #fir.var_attrs, uniq_name = "_QFallocatable_udtE.dt.ext_type"} : (!fir.ref>) -> (!fir.ref>, !fir.ref>) ! CHECK: %{{.+}}:2 = hlfir.declare %{{.+}}(%{{.+}}) {fortran_attrs = #fir.var_attrs, uniq_name = "_QFallocatable_udtE.c.ext_type"} : (!fir.ref>>, !fir.shapeshift<1>) -> (!fir.box>>, !fir.ref>>) ! CHECK: %{{.+}} = hlfir.designate %{{.+}} (%{{.+}}, %{{.+}}) : (!fir.box>>, volatile>, index, index) -> !fir.ref, volatile> ! CHECK: %{{.+}} = hlfir.designate %{{.+}}{"base_type"} : (!fir.ref, volatile>) -> !fir.ref, volatile> ! CHECK: %{{.+}} = hlfir.designate %{{.+}}{"i"} : (!fir.ref, volatile>) -> !fir.ref