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
71 lines
1.5 KiB
Fortran
71 lines
1.5 KiB
Fortran
! UNSUPPORTED: system-windows
|
|
! UNSUPPORTED: offload-cuda
|
|
|
|
! RUN: split-file %s %t
|
|
! RUN: %clang %isysroot -I"%include/flang" -c %t/cfile.c -o %t/cfile.o
|
|
! RUN: %flang %isysroot -L"%libdir" %t/ffile.f90 %t/cfile.o -o %t/ctofortran
|
|
! RUN: env LD_LIBRARY_PATH="$LD_LIBRARY_PATH:%libdir" %t/ctofortran | FileCheck %s
|
|
|
|
!--- ffile.f90
|
|
program fmain
|
|
interface
|
|
subroutine csub() bind(c)
|
|
end subroutine
|
|
end interface
|
|
|
|
call csub()
|
|
end program fmain
|
|
|
|
subroutine foo(a) bind(c)
|
|
integer :: a(:)
|
|
if (lbound(a, 1) .ne. 1) then
|
|
print *, 'FAIL expected 1 for lbound but got ',lbound(a, 1)
|
|
stop 1
|
|
endif
|
|
|
|
if (ubound(a, 1) .ne. 10) then
|
|
print *, 'FAIL expected 10 for ubound but got ',ubound(a, 1)
|
|
stop 1
|
|
endif
|
|
|
|
do i = lbound(a,1),ubound(a,1)
|
|
!print *, a(i)
|
|
if (a(i) .ne. i) then
|
|
print *, 'FAIL expected', i, ' for index ',i, ' but got ',a(i)
|
|
stop 1
|
|
endif
|
|
enddo
|
|
print *, 'PASS'
|
|
end subroutine foo
|
|
|
|
! CHECK: PASS
|
|
!--- cfile.c
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <ISO_Fortran_binding.h>
|
|
|
|
void foo(CFI_cdesc_t*);
|
|
|
|
int a[10];
|
|
|
|
void csub() {
|
|
int i, res;
|
|
static CFI_CDESC_T(1) r1;
|
|
CFI_cdesc_t *desc = (CFI_cdesc_t*)&r1;
|
|
CFI_index_t extent[1] = {10};
|
|
|
|
for(i=0; i<10; ++i) {
|
|
a[i] = i+1;
|
|
}
|
|
|
|
res = CFI_establish(desc, (void*)a, CFI_attribute_other, CFI_type_int32_t,
|
|
sizeof(int), 1, extent);
|
|
if (res != 0) {
|
|
printf("FAIL CFI_establish returned %d instead of 0.\n",res);
|
|
exit(1);
|
|
}
|
|
|
|
foo(desc);
|
|
return;
|
|
}
|