From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yb1-xb36.google.com (mail-yb1-xb36.google.com [IPv6:2607:f8b0:4864:20::b36]) by sourceware.org (Postfix) with ESMTPS id 592EF3858431 for ; Sun, 6 Feb 2022 03:39:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 592EF3858431 Received: by mail-yb1-xb36.google.com with SMTP id g14so30533856ybs.8 for ; Sat, 05 Feb 2022 19:39:07 -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:from:date:message-id:subject:to; bh=72yS6Ugj/X2ROuT9nrM+czYoghgXe9f2XM6DDrBKQEM=; b=sgTXIZaFP9F83TSf0mbxYzrkUj64GRFOLzMlzCcK2thsNI0QJUIT0vj63Sf6VLj0bO NB+rMAPZRXbukHAHL6w7W4TuXgnRL9zUWtbKnBNlyfPEbYlBd7SMW19n5LnFEWaepZwT kK5ch4BIXtuvdqvdpvdVdeQOeKZ4dTRfzef7JCPTPn4MXA24EJcMu/pXeG5Xb0DAyafj vWTWi0Q/4jSL7Gtdm0kxpkRkItJA1LCjMXRe/Vc96vTEeE9OoYrB2pmD8vqkRsM4zFyX HbSZGqKioolURWu2EWdsvZAz1NEIHh/jOJxqqkUNtN7cNNg55fWQD5vBeqXIohID5dSS uBHg== X-Gm-Message-State: AOAM532hipTmHyDXsRGgI6M2xBe83QYzlfp+nbcdZBPNn5WgpGfdhHCc qMeKlW6Z9Ba98oASQ+LVJLFfOuEgidkKgcqhTN2Ndw97nzI0NN5G11T7QdP+AEePJVRRd0rz+Ne Sbrz/dtC6hY/vjjKE3vAqU+WWNcwAaWh4BUuwmghUvA2P7fBPVezIQ//x1PsvZMkK+dZNilNA8m gk887fn69nAQpuMBahv4pxA0l4X4o= X-Google-Smtp-Source: ABdhPJwXOtzAV0haz662z2xVg8L4ZbVN4FYonxp9JxVMwUIhc2cSKPTseis//ogxBx7eim4Fs6zshRWmGbKby3L1qHw= X-Received: by 2002:a81:5f8a:: with SMTP id t132mr5896464ywb.215.1644118746576; Sat, 05 Feb 2022 19:39:06 -0800 (PST) MIME-Version: 1.0 From: Damian Rouson Date: Sat, 5 Feb 2022 19:38:55 -0800 Message-ID: Subject: Bug 104404 - Incorrect CFI_cdesc_t "type" member for assumed-type, assumed-rank complex dummy arguments To: fortran@gcc.gnu.org X-Spam-Status: No, score=0.8 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 03:39:10 -0000 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