CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
51 lines
2.6 KiB
Fortran
51 lines
2.6 KiB
Fortran
! Test lowering of CSHIFT/EOSHIFT with a dynamically optional DIM argument.
|
|
! When DIM is an optional dummy argument that is absent at runtime, it must
|
|
! default to 1 (Fortran standard 16.9.68, 16.9.77). Prior to the fix, the
|
|
! absent case caused a segmentation fault because the optional reference was
|
|
! unconditionally dereferenced without checking for presence.
|
|
! RUN: bbc -emit-hlfir -o - -I nowhere %s 2>&1 | FileCheck %s
|
|
|
|
! CSHIFT 2D with optional DIM - DIM may be absent at runtime (defaults to 1).
|
|
subroutine cshift_optional_dim(a, sh, dim)
|
|
integer :: a(:,:), sh(:)
|
|
integer, optional :: dim
|
|
a = CSHIFT(a, sh, dim)
|
|
end subroutine
|
|
! CHECK-LABEL: func.func @_QPcshift_optional_dim(
|
|
! CHECK-SAME: {{.*}}: !fir.ref<i32> {fir.bindc_name = "dim", fir.optional})
|
|
! CHECK: %[[DECL_DIM:.*]]:2 = hlfir.declare {{.*}} {fortran_attrs = #fir.var_attrs<optional>
|
|
! CHECK: %[[IS_PRESENT:.*]] = fir.is_present %[[DECL_DIM]]#0 : (!fir.ref<i32>) -> i1
|
|
! CHECK: %[[DIM_LOADED:.*]] = fir.if %[[IS_PRESENT]] -> (i32) {
|
|
! CHECK: %[[LOADED:.*]] = fir.load %[[DECL_DIM]]#0 : !fir.ref<i32>
|
|
! CHECK: fir.result %[[LOADED]] : i32
|
|
! CHECK: } else {
|
|
! CHECK: arith.constant 0 : i32
|
|
! CHECK: fir.result
|
|
! CHECK: }
|
|
! CHECK: %[[ONE:.*]] = arith.constant 1 : i32
|
|
! CHECK: %[[DIM_VAL:.*]] = arith.select %[[IS_PRESENT]], %[[DIM_LOADED]], %[[ONE]] : i32
|
|
! CHECK-NOT: arith.cmpi
|
|
! CHECK: hlfir.cshift {{.*}} dim %[[DIM_VAL]] :
|
|
|
|
! EOSHIFT 2D with optional DIM - DIM may be absent at runtime (defaults to 1).
|
|
subroutine eoshift_optional_dim(a, sh, dim)
|
|
integer :: a(:,:), sh(:)
|
|
integer, optional :: dim
|
|
a = EOSHIFT(a, sh, dim=dim)
|
|
end subroutine
|
|
! CHECK-LABEL: func.func @_QPeoshift_optional_dim(
|
|
! CHECK-SAME: {{.*}}: !fir.ref<i32> {fir.bindc_name = "dim", fir.optional})
|
|
! CHECK: %[[DECL_DIM2:.*]]:2 = hlfir.declare {{.*}} {fortran_attrs = #fir.var_attrs<optional>
|
|
! CHECK: %[[IS_PRESENT2:.*]] = fir.is_present %[[DECL_DIM2]]#0 : (!fir.ref<i32>) -> i1
|
|
! CHECK: %[[DIM_LOADED2:.*]] = fir.if %[[IS_PRESENT2]] -> (i32) {
|
|
! CHECK: %[[LOADED2:.*]] = fir.load %[[DECL_DIM2]]#0 : !fir.ref<i32>
|
|
! CHECK: fir.result %[[LOADED2]] : i32
|
|
! CHECK: } else {
|
|
! CHECK: arith.constant 0 : i32
|
|
! CHECK: fir.result
|
|
! CHECK: }
|
|
! CHECK: %[[ONE2:.*]] = arith.constant 1 : i32
|
|
! CHECK: %[[DIM_VAL2:.*]] = arith.select %[[IS_PRESENT2]], %[[DIM_LOADED2]], %[[ONE2]] : i32
|
|
! CHECK-NOT: arith.cmpi
|
|
! CHECK: hlfir.eoshift {{.*}} dim %[[DIM_VAL2]] :
|