From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yb1-xb2e.google.com (mail-yb1-xb2e.google.com [IPv6:2607:f8b0:4864:20::b2e]) by sourceware.org (Postfix) with ESMTPS id C5DAC3858D1E for ; Sun, 6 Feb 2022 12:11:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C5DAC3858D1E Received: by mail-yb1-xb2e.google.com with SMTP id y6so17731512ybc.5 for ; Sun, 06 Feb 2022 04:11:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=gp63Nwx78WGSSdMYOmmZNirc3WJNtKCMAaaejoP9r4M=; b=h5qco1JCAO/spEYmRgf7iljrAQDClU2nR/3MnVR7Pjcp2bAkuBzcM88iVjyrTILEqh FvakdTT0OPN1XcUtiUilSH/m6to+ctU4OfNpHs29IBYIj8L8wJD53i7wVpOh+Uptch7j OnSvd2YpoMSFJMvhHsU5qydh/hDZxS9yAydAHaDt/y1WmrKyxnAOUYqGg3nXPeXecAt0 ceMC/dq8r+rIJJ1ixm0bB7qqAf+uMC0ewDngIo9STBmSpNi6afwa0JQEYPvqMXUuFf1p EbqUejYBWewiM4uexKWHiMT+xkYlCpq1nAgDSX7M7227W5lJZ9MlcJNQZHGKZYt6rYgy 1ycw== X-Gm-Message-State: AOAM533t3L0cs+vkiD0GKXd7+S7AuLFpwTrzSrP7NAwlEsLQSWZXNjev J6Z8n0WdxSdc54hISUaQgcY6jU4lR6ZkUMMaC3UDPxrZcQHKVDieJn0ZjXsGj78gcU7s+NGsXj4 5hy1CveaVm2QgswYrjoxabllzwkFV8xqCFgY//uhFNjkg997ZWrYMMi6SyUH3QukOC+k9NaSS6M 7DW62fTKo5SuqvLgTdj58m64mX X-Google-Smtp-Source: ABdhPJzE87j+pnvEF9FBU8rB2e1vCwr0YNKmU4EWbVoIlmVVJccgHCEh0R3c1lJGB8YfNmgw7Mgn8iCKn1siR2gKh58= X-Received: by 2002:a25:e308:: with SMTP id z8mr6236561ybd.53.1644149475064; Sun, 06 Feb 2022 04:11:15 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Damian Rouson Date: Sun, 6 Feb 2022 04:11:04 -0800 Message-ID: Subject: Re: Bug 104404 - Incorrect CFI_cdesc_t "type" member for assumed-type, assumed-rank complex dummy arguments To: Paul Richard Thomas Cc: "fortran@gcc.gnu.org" X-Spam-Status: No, score=0.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, HTML_MESSAGE, KAM_DMARC_NONE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, TXREP, T_SCC_BODY_TEXT_LINE, T_SPF_PERMERROR autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: fortran@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Fortran mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Feb 2022 12:11:20 -0000 That's great news. Thanks for letting me know. Damian On Sun, Feb 6, 2022 at 12:48 AM Paul Richard Thomas < paul.richard.thomas@gmail.com> wrote: > Hi Damian, > > Tobias Burnus fixed it in 12-branch: > GNU Fortran (GCC) 12.0.1 20220203 (experimental) > ./a.out > ----- complex(c_float_complex) -------- > a_desc->type = 1028 > a_desc->elem_len = 8 > CFI_type_float_Complex = 1028 > CFI_type_double_Complex = 2052 > ----- complex(c_double_complex) ------- > a_desc->type = 2052 > a_desc->elem_len = 16 > CFI_type_float_Complex = 1028 > CFI_type_double_Complex = 2052 > > Cheers > > Paul > > > On Sun, 6 Feb 2022 at 03:39, Damian Rouson via Fortran < > fortran@gcc.gnu.org> wrote: > >> For an assumed-type, assumed-rank complex dummy argument in a C interface, >> gfortran 11.2.0 passes a CFI_cdesc_t object with a "type" member that does >> not match the corresponding CFI_type_float_Complex and >> CFI_type_double_Complex values. In the case of a complex(c_float_complex) >> argument, the passed "type" member corresponds to CFI_type_double_Complex. >> For a complex(c_double_complex) argument, the "type" member has a value >> that I don't recognize. Does anyone know whether this has been fixed on >> the 12 branch? >> >> % cat c_descriptor.c >> #include >> #include >> >> void c_descriptor(CFI_cdesc_t* c) >> { >> printf("a_desc->type = %d \n", c->type); >> printf("a_desc->elem_len = %d \n", c->elem_len); >> printf("CFI_type_float_Complex = %d \n", CFI_type_float_Complex); >> printf("CFI_type_double_Complex = %d \n", CFI_type_double_Complex); >> } >> >> % cat c_descriptor.c >> #include >> #include >> >> void c_descriptor(CFI_cdesc_t* c) >> { >> printf("a_desc->type = %d \n", c->type); >> printf("a_desc->elem_len = %d \n", c->elem_len); >> printf("CFI_type_float_Complex = %d \n", CFI_type_float_Complex); >> printf("CFI_type_double_Complex = %d \n", CFI_type_double_Complex); >> } >> (base) rouson@CLaSS adhoc % cat assumed-type.f90 >> module c_descriptor_m >> implicit none >> contains >> module subroutine print_type_info(a) >> type(*), intent(inout), contiguous, target :: a(..) >> >> interface >> subroutine c_descriptor(a) bind(C) >> implicit none >> type(*) a(..) >> end subroutine >> end interface >> >> call c_descriptor(a) >> >> end subroutine >> end module >> >> use c_descriptor_m >> use iso_c_binding >> implicit none >> >> complex(c_float_complex) :: z_float = (0._c_float, 0._c_float) >> complex(c_double_complex):: z_double = (0._c_double, 0._c_double) >> >> print*, "----- complex(c_float_complex) --------" >> call print_type_info(z_float) >> print*, "----- complex(c_double_complex) -------" >> call print_type_info(z_double) >> end >> >> % gfortran c_descriptor.c assumed-type.f90 >> >> % ./a.out >> ----- complex(c_float_complex) -------- >> a_desc->type = 2052 >> a_desc->elem_len = 8 >> CFI_type_float_Complex = 1028 >> CFI_type_double_Complex = 2052 >> ----- complex(c_double_complex) ------- >> a_desc->type = 4100 >> a_desc->elem_len = 16 >> CFI_type_float_Complex = 1028 >> CFI_type_double_Complex = 2052 >> >> % gfortran --version >> GNU Fortran (Homebrew GCC 11.2.0_3) 11.2.0 >> > > > -- > "If you can't explain it simply, you don't understand it well enough" - > Albert Einstein >