From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 095943858C52 for ; Tue, 5 Dec 2023 10:33:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 095943858C52 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 095943858C52 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701772400; cv=none; b=Co38y1G8QpzDBS3yBIvtaxK9g/rnONpEg518DpnJSxd+gQyXyw5q3X+x4ZRWFkjFJsDFSwra3mHbiJAsryRQLQ2TmbZEcVRdkgNcplgdgZ8VPKUaKSND5fJmsaf0xpxKg8LX+q+xWKXYSAai/NcEv2HKw52E0X7yBQ/BZLdJSjs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701772400; c=relaxed/simple; bh=22dd1J/WNh3osnnYuFOQNP+J47NS3QTubqK1dqWkrhs=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=iybAbtxUMKgT7oWrBL7XwjZcPtAQYc5dbd+WzzGAg3ZghWkWVhxt8aLvdhwmJkOrQwb4qnJUIjZ6+LzurCvDt3S2rwqJRsumwWFP+0Xlor7XVrrMbgn/cv/hbvtqvyhBYAl7T/XvMBkozFy62qFpCG7u72ogZYnJtCavNkv1qXs= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701772398; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=QAyWUHt2a6AcWh3RvoF09g6WlZiJ/IGnZf0yehya9XY=; b=Rz57UGH8TmWb9JZRjvNz0OmB92OVHbeIqLQItGcQcq2Rl+stu2c7F4GQQIblDNMzzOQUla l9LfNgFkGGG77xx1NX7LhD2twyLK8E/KA+pEsEL31wEE0lJupsSTycT0T8H5nI1bwBasTU gVqIlJmOoOSAA8/L9qccp1w97kHDC/s= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-323-lh5UYHCTNw6KHcM2ljcbPA-1; Tue, 05 Dec 2023 05:33:15 -0500 X-MC-Unique: lh5UYHCTNw6KHcM2ljcbPA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 444F885A58C; Tue, 5 Dec 2023 10:33:15 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.195.157]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 05B842026D66; Tue, 5 Dec 2023 10:33:14 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 3B5AXCCi723709 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 5 Dec 2023 11:33:12 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 3B5AX6Sw723708; Tue, 5 Dec 2023 11:33:06 +0100 Date: Tue, 5 Dec 2023 11:33:05 +0100 From: Jakub Jelinek To: Tobias Burnus , Florian Weimer Cc: Richard Earnshaw , gcc-patches@gcc.gnu.org, fortran@gcc.gnu.org Subject: [PATCH] libgfortran: Fix -Wincompatible-pointer-types errors Message-ID: Reply-To: Jakub Jelinek References: <9e40a64880a14cf27d788ecbaf23365b9a5ac069.1700473918.git.fweimer@redhat.com> <87zfypvv6t.fsf@oldenburg.str.redhat.com> MIME-Version: 1.0 In-Reply-To: <87zfypvv6t.fsf@oldenburg.str.redhat.com> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-9.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi! On Tue, Dec 05, 2023 at 10:46:02AM +0100, Florian Weimer wrote: > Presumably the fixes will look like this? > > diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c > index db3330060ce..4fcc77dbf83 100644 > --- a/libgfortran/io/list_read.c > +++ b/libgfortran/io/list_read.c > @@ -2987,13 +2987,13 @@ nml_read_obj (st_parameter_dt *dtp, namelist_info *nl, index_type offset, > /* If this object has a User Defined procedure, call it. */ > if (nl->dtio_sub != NULL) > { > - int unit = dtp->u.p.current_unit->unit_number; > + GFC_INTEGER_4 unit = dtp->u.p.current_unit->unit_number; > char iotype[] = "NAMELIST"; > gfc_charlen_type iotype_len = 8; > char tmp_iomsg[IOMSG_LEN] = ""; > char *child_iomsg; > gfc_charlen_type child_iomsg_len; > - int noiostat; > + GFC_INTEGER_4 noiostat; > int *child_iostat = NULL; > gfc_full_array_i4 vlist; > formatted_dtio dtio_ptr = (formatted_dtio)nl->dtio_sub; That seems insufficient. The following patch makes libgfortran build on i686-linux after hacking up --- kinds.h.xx 2023-12-05 00:23:00.133365064 +0100 +++ kinds.h 2023-12-05 11:19:24.409679808 +0100 @@ -10,8 +10,8 @@ typedef GFC_INTEGER_2 GFC_LOGICAL_2; #define HAVE_GFC_LOGICAL_2 #define HAVE_GFC_INTEGER_2 -typedef int32_t GFC_INTEGER_4; -typedef uint32_t GFC_UINTEGER_4; +typedef long GFC_INTEGER_4; +typedef unsigned long GFC_UINTEGER_4; typedef GFC_INTEGER_4 GFC_LOGICAL_4; #define HAVE_GFC_LOGICAL_4 #define HAVE_GFC_INTEGER_4 in the build dir to emulate what newlib aarch64 is doing: 2023-12-05 Florian Weimer Jakub Jelinek * io/list_read.c (list_formatted_read_scalar) : Change types of unit and noiostat to GFC_INTEGER_4 from int, change type of child_iostat from to GFC_INTEGER_4 * from int *, formatting fixes. (nml_read_obj): Likewise. * io/write.c (list_formatted_write_scalar) : Likewise. (nml_write_obj): Likewise. * io/transfer.c (unformatted_read, unformatted_write): Likewise. --- libgfortran/io/list_read.c.jj 2023-05-09 00:07:26.161168737 +0200 +++ libgfortran/io/list_read.c 2023-12-05 11:25:31.837426653 +0100 @@ -2189,14 +2189,14 @@ list_formatted_read_scalar (st_parameter break; case BT_CLASS: { - int unit = dtp->u.p.current_unit->unit_number; + GFC_INTEGER_4 unit = dtp->u.p.current_unit->unit_number; char iotype[] = "LISTDIRECTED"; gfc_charlen_type iotype_len = 12; char tmp_iomsg[IOMSG_LEN] = ""; char *child_iomsg; gfc_charlen_type child_iomsg_len; - int noiostat; - int *child_iostat = NULL; + GFC_INTEGER_4 noiostat; + GFC_INTEGER_4 *child_iostat = NULL; gfc_full_array_i4 vlist; GFC_DESCRIPTOR_DATA(&vlist) = NULL; @@ -2204,8 +2204,8 @@ list_formatted_read_scalar (st_parameter /* Set iostat, intent(out). */ noiostat = 0; - child_iostat = (dtp->common.flags & IOPARM_HAS_IOSTAT) ? - dtp->common.iostat : &noiostat; + child_iostat = ((dtp->common.flags & IOPARM_HAS_IOSTAT) + ? dtp->common.iostat : &noiostat); /* Set iomsge, intent(inout). */ if (dtp->common.flags & IOPARM_HAS_IOMSG) @@ -2987,14 +2987,14 @@ nml_read_obj (st_parameter_dt *dtp, name /* If this object has a User Defined procedure, call it. */ if (nl->dtio_sub != NULL) { - int unit = dtp->u.p.current_unit->unit_number; + GFC_INTEGER_4 unit = dtp->u.p.current_unit->unit_number; char iotype[] = "NAMELIST"; gfc_charlen_type iotype_len = 8; char tmp_iomsg[IOMSG_LEN] = ""; char *child_iomsg; gfc_charlen_type child_iomsg_len; - int noiostat; - int *child_iostat = NULL; + GFC_INTEGER_4 noiostat; + GFC_INTEGER_4 *child_iostat = NULL; gfc_full_array_i4 vlist; formatted_dtio dtio_ptr = (formatted_dtio)nl->dtio_sub; @@ -3006,8 +3006,8 @@ nml_read_obj (st_parameter_dt *dtp, name /* Set iostat, intent(out). */ noiostat = 0; - child_iostat = (dtp->common.flags & IOPARM_HAS_IOSTAT) ? - dtp->common.iostat : &noiostat; + child_iostat = ((dtp->common.flags & IOPARM_HAS_IOSTAT) + ? dtp->common.iostat : &noiostat); /* Set iomsg, intent(inout). */ if (dtp->common.flags & IOPARM_HAS_IOMSG) --- libgfortran/io/write.c.jj 2023-09-28 21:49:38.632795791 +0200 +++ libgfortran/io/write.c 2023-12-05 11:26:27.763627070 +0100 @@ -1952,14 +1952,14 @@ list_formatted_write_scalar (st_paramete break; case BT_CLASS: { - int unit = dtp->u.p.current_unit->unit_number; + GFC_INTEGER_4 unit = dtp->u.p.current_unit->unit_number; char iotype[] = "LISTDIRECTED"; gfc_charlen_type iotype_len = 12; char tmp_iomsg[IOMSG_LEN] = ""; char *child_iomsg; gfc_charlen_type child_iomsg_len; - int noiostat; - int *child_iostat = NULL; + GFC_INTEGER_4 noiostat; + GFC_INTEGER_4 *child_iostat = NULL; gfc_full_array_i4 vlist; GFC_DESCRIPTOR_DATA(&vlist) = NULL; @@ -1967,8 +1967,8 @@ list_formatted_write_scalar (st_paramete /* Set iostat, intent(out). */ noiostat = 0; - child_iostat = (dtp->common.flags & IOPARM_HAS_IOSTAT) ? - dtp->common.iostat : &noiostat; + child_iostat = ((dtp->common.flags & IOPARM_HAS_IOSTAT) + ? dtp->common.iostat : &noiostat); /* Set iomsge, intent(inout). */ if (dtp->common.flags & IOPARM_HAS_IOMSG) @@ -2277,14 +2277,14 @@ nml_write_obj (st_parameter_dt *dtp, nam /* First ext_name => get length of all possible components */ if (obj->dtio_sub != NULL) { - int unit = dtp->u.p.current_unit->unit_number; + GFC_INTEGER_4 unit = dtp->u.p.current_unit->unit_number; char iotype[] = "NAMELIST"; gfc_charlen_type iotype_len = 8; char tmp_iomsg[IOMSG_LEN] = ""; char *child_iomsg; gfc_charlen_type child_iomsg_len; - int noiostat; - int *child_iostat = NULL; + GFC_INTEGER_4 noiostat; + GFC_INTEGER_4 *child_iostat = NULL; gfc_full_array_i4 vlist; formatted_dtio dtio_ptr = (formatted_dtio)obj->dtio_sub; @@ -2292,8 +2292,8 @@ nml_write_obj (st_parameter_dt *dtp, nam /* Set iostat, intent(out). */ noiostat = 0; - child_iostat = (dtp->common.flags & IOPARM_HAS_IOSTAT) ? - dtp->common.iostat : &noiostat; + child_iostat = ((dtp->common.flags & IOPARM_HAS_IOSTAT) + ? dtp->common.iostat : &noiostat); /* Set iomsg, intent(inout). */ if (dtp->common.flags & IOPARM_HAS_IOMSG) --- libgfortran/io/transfer.c.jj 2023-05-09 00:07:26.162168723 +0200 +++ libgfortran/io/transfer.c 2023-12-05 11:25:15.756656561 +0100 @@ -1092,17 +1092,17 @@ unformatted_read (st_parameter_dt *dtp, if (type == BT_CLASS) { - int unit = dtp->u.p.current_unit->unit_number; + GFC_INTEGER_4 unit = dtp->u.p.current_unit->unit_number; char tmp_iomsg[IOMSG_LEN] = ""; char *child_iomsg; gfc_charlen_type child_iomsg_len; - int noiostat; - int *child_iostat = NULL; + GFC_INTEGER_4 noiostat; + GFC_INTEGER_4 *child_iostat = NULL; /* Set iostat, intent(out). */ noiostat = 0; - child_iostat = (dtp->common.flags & IOPARM_HAS_IOSTAT) ? - dtp->common.iostat : &noiostat; + child_iostat = ((dtp->common.flags & IOPARM_HAS_IOSTAT) + ? dtp->common.iostat : &noiostat); /* Set iomsg, intent(inout). */ if (dtp->common.flags & IOPARM_HAS_IOMSG) @@ -1119,7 +1119,7 @@ unformatted_read (st_parameter_dt *dtp, /* Call the user defined unformatted READ procedure. */ dtp->u.p.current_unit->child_dtio++; dtp->u.p.ufdtio_ptr (dest, &unit, child_iostat, child_iomsg, - child_iomsg_len); + child_iomsg_len); dtp->u.p.current_unit->child_dtio--; return; } @@ -1222,17 +1222,17 @@ unformatted_write (st_parameter_dt *dtp, if (type == BT_CLASS) { - int unit = dtp->u.p.current_unit->unit_number; + GFC_INTEGER_4 unit = dtp->u.p.current_unit->unit_number; char tmp_iomsg[IOMSG_LEN] = ""; char *child_iomsg; gfc_charlen_type child_iomsg_len; - int noiostat; - int *child_iostat = NULL; + GFC_INTEGER_4 noiostat; + GFC_INTEGER_4 *child_iostat = NULL; /* Set iostat, intent(out). */ noiostat = 0; - child_iostat = (dtp->common.flags & IOPARM_HAS_IOSTAT) ? - dtp->common.iostat : &noiostat; + child_iostat = ((dtp->common.flags & IOPARM_HAS_IOSTAT) + ? dtp->common.iostat : &noiostat); /* Set iomsg, intent(inout). */ if (dtp->common.flags & IOPARM_HAS_IOMSG) @@ -1249,7 +1249,7 @@ unformatted_write (st_parameter_dt *dtp, /* Call the user defined unformatted WRITE procedure. */ dtp->u.p.current_unit->child_dtio++; dtp->u.p.ufdtio_ptr (source, &unit, child_iostat, child_iomsg, - child_iomsg_len); + child_iomsg_len); dtp->u.p.current_unit->child_dtio--; return; } @@ -1688,13 +1688,13 @@ formatted_transfer_scalar_read (st_param return; if (require_type (dtp, BT_CLASS, type, f)) return; - int unit = dtp->u.p.current_unit->unit_number; + GFC_INTEGER_4 unit = dtp->u.p.current_unit->unit_number; char dt[] = "DT"; char tmp_iomsg[IOMSG_LEN] = ""; char *child_iomsg; gfc_charlen_type child_iomsg_len; - int noiostat; - int *child_iostat = NULL; + GFC_INTEGER_4 noiostat; + GFC_INTEGER_4 *child_iostat = NULL; char *iotype; gfc_charlen_type iotype_len = f->u.udf.string_len; @@ -1709,8 +1709,8 @@ formatted_transfer_scalar_read (st_param /* Set iostat, intent(out). */ noiostat = 0; - child_iostat = (dtp->common.flags & IOPARM_HAS_IOSTAT) ? - dtp->common.iostat : &noiostat; + child_iostat = ((dtp->common.flags & IOPARM_HAS_IOSTAT) + ? dtp->common.iostat : &noiostat); /* Set iomsg, intent(inout). */ if (dtp->common.flags & IOPARM_HAS_IOMSG) @@ -2169,13 +2169,13 @@ formatted_transfer_scalar_write (st_para case FMT_DT: if (n == 0) goto need_data; - int unit = dtp->u.p.current_unit->unit_number; + GFC_INTEGER_4 unit = dtp->u.p.current_unit->unit_number; char dt[] = "DT"; char tmp_iomsg[IOMSG_LEN] = ""; char *child_iomsg; gfc_charlen_type child_iomsg_len; - int noiostat; - int *child_iostat = NULL; + GFC_INTEGER_4 noiostat; + GFC_INTEGER_4 *child_iostat = NULL; char *iotype; gfc_charlen_type iotype_len = f->u.udf.string_len; @@ -2190,8 +2190,8 @@ formatted_transfer_scalar_write (st_para /* Set iostat, intent(out). */ noiostat = 0; - child_iostat = (dtp->common.flags & IOPARM_HAS_IOSTAT) ? - dtp->common.iostat : &noiostat; + child_iostat = ((dtp->common.flags & IOPARM_HAS_IOSTAT) + ? dtp->common.iostat : &noiostat); /* Set iomsg, intent(inout). */ if (dtp->common.flags & IOPARM_HAS_IOMSG) Jakub