From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id 3A6363888837; Tue, 29 Mar 2022 07:14:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3A6363888837 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="5.90,219,1643702400"; d="scan'208";a="76323680" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa1.mentor.iphmx.com with ESMTP; 28 Mar 2022 23:14:11 -0800 IronPort-SDR: BufiVcqyvOd0GmGh599jvau3Sk/nJYa4oCbN+3aLhc9m9zv8NA+dHooS69Y/85sTRtbdqs7AID H/MBzgBKUQBnQqAb8LGXiWOBgTWjNG/I6JNA+Gdi28t0tcZ1LIdWsiPiVI9FjXNLX+TieAk8Pi tSf32WvKNV0qiBfY43PwEh03KSo+OqATNrHMbjkccz5wPFstFZBRAK/KgKWiB017HL5fS9P9Fq UR4ESwu1zsD7yl9LRDUBnDb+IzqO3A9C8IqFws66MOJOn9Zd9FaEPuojjZ79n+YUirUKZJCA3a g48= Message-ID: <89773980-593c-727a-28c9-d3304cd1aa78@codesourcery.com> Date: Tue, 29 Mar 2022 09:14:04 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH] PR fortran/50549 - should detect different type parameters in structure constructors Content-Language: en-US To: Harald Anlauf , fortran , gcc-patches References: <5a7fa9f6-7155-9dc6-d847-e44ccccb447a@codesourcery.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-10.mgc.mentorg.com (139.181.222.10) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_SHORT, NICE_REPLY_A, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org 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: Tue, 29 Mar 2022 07:14:15 -0000 Hi Harald, On 28.03.22 22:03, Harald Anlauf via Fortran wrote: > All current cases of printing a HOST_WIDE_INT in gcc/fortran/ use > 'sprintf', and I did not find any other use of %wd/%wu. So the > mentioned implementation is not really stressed yet... ;-) That's all your fault ;-) (Your commit https://gcc.gnu.org/r12-3273-ge4cb3bb9ac11b4126ffa718287dd509a4b10a658 did remove the only user.) > ../../gcc-trunk/gcc/fortran/resolve.cc: In function 'bool > resolve_structure_cons(gfc_expr*, int)': > ../../gcc-trunk/gcc/fortran/resolve.cc:1388:43: warning: unknown > conversion type character 'w' in format [-Wformat=3D] > la, lb, comp->name, &cons->expr->where); > ^ That's only a warning. Have you tried whether it works at runtime? My bet is that it does! Question: Do you build with --disable-bootstrap ? Or do you do a proper boo= tstrap? I am asking because: * Here, it bootstraps *without* warnings/errors (I do a full bootstrap) * GCC is bootstrapped with -Werror, i.e. I had expected an error and not a = warning, while with --disable-bootstrap, the -Werror is not used as some random compiler may have additional (correct or bogus) warnings. * %wd is only supported since GCC 12. The supported formats + the warning is bound to the compiler version, i.e. an older compiler does not support newer flags and, thus, warns for them when compiling. (But as the support depends on the current source, the compile-time warning of older compilers can be ignored.) * * * Can you check & try again? I don't mind getting a format warning with GCC < GCC 12. But with GCC 12 compiled (either installed compiler or when bootstrapping) it should compile without errors. If you can confirm my suspicion, the patch LGTM. Tobias PS: I played around a bit. And with a GCC 12 bootstrap, I get as expected an error (not a warning) for something unsupported (%Wd) while %wd is supported. Additionally, I see a '|' in the output. The "|" appeared with GCC 9. Thus, I wonder whether you compile w/o bootstrapping with GCC 8? ../gcc/fortran/resolve.cc:1386:55: error: unknown conversion type character= =E2=80=98W=E2=80=99 in format [-Werror=3Dformat=3D] 1386 | gfc_error ("Unequal character lengths (%Wd/%wd) for = pointer " | ^ ----------------- 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