Skip to content

flang-new: assumed-rank variable not implemented #95990

Closed
@raffenet

Description

@raffenet

The MPICH library (https://github.com/pmodels/mpich) mpi_f08 Fortran binding is unable to be built with flang-new from recent main branch. This the error seen when testing compiler support for the necessary features.

ConvertVariable.cpp:1901: not yet implemented: assumed-rank variable in procedure implemented in Fortran

Is there any ETA on support for assumed-rank? I'm including the program we use to test compiler support for reproducibility.

#include <ISO_Fortran_binding.h>

int foo_c(CFI_cdesc_t * a_desc, CFI_cdesc_t * b_desc)
{
	char * a_row = (char*) a_desc->base_addr;
	if (a_desc->type != CFI_type_int) { return 1; }
	if (a_desc->rank != 2) { return 2; }
	if (a_desc->dim[1].extent != b_desc->dim[0].extent) { return 3; }
	return 0;
}

void test_assumed_rank_async_impl_c(CFI_cdesc_t * a_desc)
{
	CFI_is_contiguous(a_desc);
	return;
}
MODULE F08TS_MODULE
IMPLICIT NONE

! Test public, private, protected
REAL, PUBLIC       :: x
REAL, PRIVATE      :: y
LOGICAL, PROTECTED :: z

! Test abstract
ABSTRACT INTERFACE
    SUBROUTINE user_func(x, y)
        INTEGER  :: x(*)
        REAL     :: y
    END SUBROUTINE
END INTERFACE

! Test TS 29113 assumed type , assumed rank and bind(C)
INTERFACE
    FUNCTION FOO(A, B, C) &
        BIND(C,name="foo_c") RESULT(err)
        USE, intrinsic :: iso_c_binding, ONLY : c_int
        TYPE(*), DIMENSION(..) :: A, B, C
        INTEGER(c_int) :: err
    END FUNCTION FOO
END INTERFACE


! Test assumed-rank + asynchronous
INTERFACE TEST_ASSUMED_RANK_ASYNC
    SUBROUTINE TEST_ASSUMED_RANK_ASYNC_IMPL(BUF) &
        BIND(C,name="test_assumed_rank_async_impl_c")
        IMPLICIT NONE
        TYPE(*), DIMENSION(..), ASYNCHRONOUS :: BUF
    END SUBROUTINE TEST_ASSUMED_RANK_ASYNC_IMPL
END INTERFACE TEST_ASSUMED_RANK_ASYNC

CONTAINS

! Test TS 29113 asynchronous attribute and optional
SUBROUTINE test1(buf, count, ierr)
    INTEGER, ASYNCHRONOUS :: buf(*)
    INTEGER               :: count
    INTEGER, OPTIONAL     :: ierr
END SUBROUTINE

! Test procedure type and non-bind(c) x in C_FUNCLOC(x)
SUBROUTINE test2(func)
    USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_FUNLOC, C_FUNPTR
    PROCEDURE(user_func)  :: func
    TYPE(C_FUNPTR) :: errhandler_fn
    errhandler_fn = C_FUNLOC(func)
END SUBROUTINE

! Test intrinsic storage_size
SUBROUTINE test3(x, size)
    CHARACTER, DIMENSION(..) :: x
    INTEGER, INTENT(OUT) :: size
    size = storage_size(x)/8
END SUBROUTINE test3

END MODULE

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions