From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180]) by sourceware.org (Postfix) with ESMTPS id 608B23858407; Tue, 5 Dec 2023 13:36:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 608B23858407 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 608B23858407 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=68.232.137.180 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701783366; cv=none; b=blFCD3A0P+F/PRy26Ga70eXguEb9G/IIZi2Bm7B7SbjTFUTJaPcWW9+TDSJkRoOTv2d+uumxpeCCJ7YK2JOW/t3LYuWUCrF08TqLyX63AcKtt1LQrIPb7T5JirChEcH9rHZKhGwia6g1Ms4GNSSRpcGlGwZzjBRu7p4uZ3z2ezA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701783366; c=relaxed/simple; bh=Uv3peUfltL09apOlrbePlASYklSuH3/6QeExFDk9EWY=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=UpL75zlD+XO1SJESJFy9cgqs+Npq7I5T7MN7cvizYacwsU+H9SAiQbo/z8dGS0FRVm64OcXrq2v258ZXTu6tRomgNtmR+caT9KKhoh3+Siim9ZnUmUQd20sGTZXzPit4Oq4pZOqfmKdhN4f6zskLrgNjonS62TKgYWicB2cu1F8= ARC-Authentication-Results: i=1; server2.sourceware.org X-CSE-ConnectionGUID: 2noGLDjcQ3ihshhNbs9w5Q== X-CSE-MsgGUID: oBEIsSiySN2jsUNiJXheyw== X-IronPort-AV: E=Sophos;i="6.04,252,1695715200"; d="scan'208";a="24527303" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa3.mentor.iphmx.com with ESMTP; 05 Dec 2023 05:35:56 -0800 IronPort-SDR: 9NCvKt1KIPekVSRUdaRZ+EkAie+OUOKapLgyWEMLMee4qQ1kFay2zpPqYJh32xLwYjP4cdsC8M m6GQ5bb41ak5uSme5rFFTDxTocl0xodD9nJd9Cz+ii4lfur9GRuUuCSnYqFBLHggusIXAWJojp X6fnVv41Btb8zioIPcX+8n3CdkRhK5EDzbao6C3PjBJjj+b/PctF04K1Ke+uAUSaarCSqoiJYA 4NZVjkcBSWnotedeYjgzCUaxBnoXxG3KtpfshqVLo0hI9iHCWLNsGkNA8Ox0hBZ7n3QRBJLkKi 0R8= Message-ID: Date: Tue, 5 Dec 2023 14:35:50 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] libgfortran: Fix -Wincompatible-pointer-types errors Content-Language: en-US To: Jakub Jelinek , Florian Weimer CC: Richard Earnshaw , , References: <9e40a64880a14cf27d788ecbaf23365b9a5ac069.1700473918.git.fweimer@redhat.com> <87zfypvv6t.fsf@oldenburg.str.redhat.com> From: Tobias Burnus In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: quoted-printable X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-11.mgc.mentorg.com (139.181.222.11) To svr-ies-mbx-12.mgc.mentorg.com (139.181.222.12) X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00,GIT_PATCH_0,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,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 all, the patch submission looks confusing as the context is a bit unclear (aarch64 having two integer types?) and the slightly unmotivated 'long' change (as explained in later emails: used as trick to find all locations that should be changed and not being part of actually proposed patch). However, once this has been disentangled, the patch LGTM, assuming and being positive that no aarch64 maintainer sees a problem. Tobias On 05.12.23 11:33, Jakub Jelinek wrote: > 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_inf= o *nl, index_type offset, >> /* If this object has a User Defined procedure, call it. */ >> if (nl->dtio_sub !=3D NULL) >> { >> - int unit =3D dtp->u.p.current_unit->unit_number; >> + GFC_INTEGER_4 unit =3D dtp->u.p.current_unit->unit_number; >> char iotype[] =3D "NAMELIST"; >> gfc_charlen_type iotype_len =3D 8; >> char tmp_iomsg[IOMSG_LEN] =3D ""; >> char *child_iomsg; >> gfc_charlen_type child_iomsg_len; >> - int noiostat; >> + GFC_INTEGER_4 noiostat; >> int *child_iostat =3D NULL; >> gfc_full_array_i4 vlist; >> formatted_dtio dtio_ptr =3D (formatted_dtio)nl->dtio_sub; > That seems insufficient. > > The following patch makes libgfortran build on i686-linux after hacking u= p > --- 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) : Likewis= e. > (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 =3D dtp->u.p.current_unit->unit_number; > + GFC_INTEGER_4 unit =3D dtp->u.p.current_unit->unit_number; > char iotype[] =3D "LISTDIRECTED"; > gfc_charlen_type iotype_len =3D 12; > char tmp_iomsg[IOMSG_LEN] =3D ""; > char *child_iomsg; > gfc_charlen_type child_iomsg_len; > - int noiostat; > - int *child_iostat =3D NULL; > + GFC_INTEGER_4 noiostat; > + GFC_INTEGER_4 *child_iostat =3D NULL; > gfc_full_array_i4 vlist; > > GFC_DESCRIPTOR_DATA(&vlist) =3D NULL; > @@ -2204,8 +2204,8 @@ list_formatted_read_scalar (st_parameter > > /* Set iostat, intent(out). */ > noiostat =3D 0; > - child_iostat =3D (dtp->common.flags & IOPARM_HAS_IOSTAT) ? > - dtp->common.iostat : &noiostat; > + child_iostat =3D ((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 !=3D NULL) > { > - int unit =3D dtp->u.p.current_unit->unit_number; > + GFC_INTEGER_4 unit =3D dtp->u.p.current_unit->unit_number; > char iotype[] =3D "NAMELIST"; > gfc_charlen_type iotype_len =3D 8; > char tmp_iomsg[IOMSG_LEN] =3D ""; > char *child_iomsg; > gfc_charlen_type child_iomsg_len; > - int noiostat; > - int *child_iostat =3D NULL; > + GFC_INTEGER_4 noiostat; > + GFC_INTEGER_4 *child_iostat =3D NULL; > gfc_full_array_i4 vlist; > formatted_dtio dtio_ptr =3D (formatted_dtio)nl->dtio_sub; > > @@ -3006,8 +3006,8 @@ nml_read_obj (st_parameter_dt *dtp, name > > /* Set iostat, intent(out). */ > noiostat =3D 0; > - child_iostat =3D (dtp->common.flags & IOPARM_HAS_IOSTAT) ? > - dtp->common.iostat : &noiostat; > + child_iostat =3D ((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 =3D dtp->u.p.current_unit->unit_number; > + GFC_INTEGER_4 unit =3D dtp->u.p.current_unit->unit_number; > char iotype[] =3D "LISTDIRECTED"; > gfc_charlen_type iotype_len =3D 12; > char tmp_iomsg[IOMSG_LEN] =3D ""; > char *child_iomsg; > gfc_charlen_type child_iomsg_len; > - int noiostat; > - int *child_iostat =3D NULL; > + GFC_INTEGER_4 noiostat; > + GFC_INTEGER_4 *child_iostat =3D NULL; > gfc_full_array_i4 vlist; > > GFC_DESCRIPTOR_DATA(&vlist) =3D NULL; > @@ -1967,8 +1967,8 @@ list_formatted_write_scalar (st_paramete > > /* Set iostat, intent(out). */ > noiostat =3D 0; > - child_iostat =3D (dtp->common.flags & IOPARM_HAS_IOSTAT) ? > - dtp->common.iostat : &noiostat; > + child_iostat =3D ((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 =3D> get length of all possible components = */ > if (obj->dtio_sub !=3D NULL) > { > - int unit =3D dtp->u.p.current_unit->unit_number; > + GFC_INTEGER_4 unit =3D dtp->u.p.current_unit->unit_number= ; > char iotype[] =3D "NAMELIST"; > gfc_charlen_type iotype_len =3D 8; > char tmp_iomsg[IOMSG_LEN] =3D ""; > char *child_iomsg; > gfc_charlen_type child_iomsg_len; > - int noiostat; > - int *child_iostat =3D NULL; > + GFC_INTEGER_4 noiostat; > + GFC_INTEGER_4 *child_iostat =3D NULL; > gfc_full_array_i4 vlist; > formatted_dtio dtio_ptr =3D (formatted_dtio)obj->dtio_sub= ; > > @@ -2292,8 +2292,8 @@ nml_write_obj (st_parameter_dt *dtp, nam > > /* Set iostat, intent(out). */ > noiostat =3D 0; > - child_iostat =3D (dtp->common.flags & IOPARM_HAS_IOSTAT) = ? > - dtp->common.iostat : &noiostat; > + child_iostat =3D ((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 =3D=3D BT_CLASS) > { > - int unit =3D dtp->u.p.current_unit->unit_number; > + GFC_INTEGER_4 unit =3D dtp->u.p.current_unit->unit_number; > char tmp_iomsg[IOMSG_LEN] =3D ""; > char *child_iomsg; > gfc_charlen_type child_iomsg_len; > - int noiostat; > - int *child_iostat =3D NULL; > + GFC_INTEGER_4 noiostat; > + GFC_INTEGER_4 *child_iostat =3D NULL; > > /* Set iostat, intent(out). */ > noiostat =3D 0; > - child_iostat =3D (dtp->common.flags & IOPARM_HAS_IOSTAT) ? > - dtp->common.iostat : &noiostat; > + child_iostat =3D ((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 =3D=3D BT_CLASS) > { > - int unit =3D dtp->u.p.current_unit->unit_number; > + GFC_INTEGER_4 unit =3D dtp->u.p.current_unit->unit_number; > char tmp_iomsg[IOMSG_LEN] =3D ""; > char *child_iomsg; > gfc_charlen_type child_iomsg_len; > - int noiostat; > - int *child_iostat =3D NULL; > + GFC_INTEGER_4 noiostat; > + GFC_INTEGER_4 *child_iostat =3D NULL; > > /* Set iostat, intent(out). */ > noiostat =3D 0; > - child_iostat =3D (dtp->common.flags & IOPARM_HAS_IOSTAT) ? > - dtp->common.iostat : &noiostat; > + child_iostat =3D ((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 =3D dtp->u.p.current_unit->unit_number; > + GFC_INTEGER_4 unit =3D dtp->u.p.current_unit->unit_number; > char dt[] =3D "DT"; > char tmp_iomsg[IOMSG_LEN] =3D ""; > char *child_iomsg; > gfc_charlen_type child_iomsg_len; > - int noiostat; > - int *child_iostat =3D NULL; > + GFC_INTEGER_4 noiostat; > + GFC_INTEGER_4 *child_iostat =3D NULL; > char *iotype; > gfc_charlen_type iotype_len =3D f->u.udf.string_len; > > @@ -1709,8 +1709,8 @@ formatted_transfer_scalar_read (st_param > > /* Set iostat, intent(out). */ > noiostat =3D 0; > - child_iostat =3D (dtp->common.flags & IOPARM_HAS_IOSTAT) ? > - dtp->common.iostat : &noiostat; > + child_iostat =3D ((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 =3D=3D 0) > goto need_data; > - int unit =3D dtp->u.p.current_unit->unit_number; > + GFC_INTEGER_4 unit =3D dtp->u.p.current_unit->unit_number; > char dt[] =3D "DT"; > char tmp_iomsg[IOMSG_LEN] =3D ""; > char *child_iomsg; > gfc_charlen_type child_iomsg_len; > - int noiostat; > - int *child_iostat =3D NULL; > + GFC_INTEGER_4 noiostat; > + GFC_INTEGER_4 *child_iostat =3D NULL; > char *iotype; > gfc_charlen_type iotype_len =3D f->u.udf.string_len; > > @@ -2190,8 +2190,8 @@ formatted_transfer_scalar_write (st_para > > /* Set iostat, intent(out). */ > noiostat =3D 0; > - child_iostat =3D (dtp->common.flags & IOPARM_HAS_IOSTAT) ? > - dtp->common.iostat : &noiostat; > + child_iostat =3D ((dtp->common.flags & IOPARM_HAS_IOSTAT) > + ? dtp->common.iostat : &noiostat); > > /* Set iomsg, intent(inout). */ > if (dtp->common.flags & IOPARM_HAS_IOMSG) > > > Jakub > ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstra=C3=9Fe 201= , 80634 M=C3=BCnchen; Gesellschaft mit beschr=C3=A4nkter Haftung; Gesch=C3= =A4ftsf=C3=BChrer: Thomas Heurung, Frank Th=C3=BCrauf; Sitz der Gesellschaf= t: M=C3=BCnchen; Registergericht M=C3=BCnchen, HRB 106955