From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by sourceware.org (Postfix) with ESMTPS id E0E523856974 for ; Sun, 1 Oct 2023 11:35:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E0E523856974 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 2722FCE0A56; Sun, 1 Oct 2023 11:35:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94A19C433C7; Sun, 1 Oct 2023 11:35:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696160115; bh=LhdrubxVVfJJXxGHYm9c1ro8MBXrTj4fe/smhS5shRc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DssFjqt4Vh0z+mHWK8g64gKePTw/+cRdeKruaB9H+RjbUClZ4tOmL6zAz6Y1AyEbI CWS2HgvlOpm1/DpPD69MyKhUYZVeCtBhD/2Y0sdUTOrbDXtNIWmRRfbzxiRS0rVNcU +V/CXyw57/WFG/1vRFAw+JtZNhkNM2sYE1ZNvnEvFIee7S7dK6zJRQbAAuszEaKN+c QR5nthxRG7Pud6sOkiGa2mrDBXJMPD3JCSNl+akUhF4tG5+WN7MOcnHFd8wBl36mKI 7thBCWcP8Pt82oHgc9TCgidsCcpe2wn0vFyeIpJngPHswVoTkn2ARMEiZc29MG76wF /3UQlJuXUcWug== Date: Sun, 1 Oct 2023 13:35:12 +0200 From: Alejandro Colomar To: Martin Uecker Cc: David Malcolm , gcc-patches@gcc.gnu.org Subject: Re: [PATCH v2] C, ObjC: Add -Wunterminated-string-initialization Message-ID: References: <20230324133928.14753-1-alx@kernel.org> <7d57dcfbc21caa2c6d9ac1118f4f6a34a8fb341c.camel@redhat.com> <2ovxkeqosz3c7wtk4mkfvkkp66prki5o4zicz6rcmwx4ajsci6@qm3bkfiqvh6a> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="33sjkpsblsedcdbe" Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS,TXREP 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: --33sjkpsblsedcdbe Content-Type: text/plain; protected-headers=v1; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Subject: Re: [PATCH v2] C, ObjC: Add -Wunterminated-string-initialization MIME-Version: 1.0 On Sun, Oct 01, 2023 at 09:37:59AM +0200, Martin Uecker wrote: >=20 > (I shortened the recipient list) >=20 > Am Sonntag, dem 01.10.2023 um 02:55 +0200 schrieb Alejandro Colomar: >=20 > > >=20 > ... > > I ran the tests, and get some unexpected failure. I used dg-warning, > > but maybe I used it wrong? Here's the output: > >=20 > > ``` > > output is: > > /home/alx/src/gnu/gcc/wustr/gcc/testsuite/gcc.dg/Wunterminated-string-i= nitialization.c:5:14: warning: initializer-string for array of 'char' is to= o long [-Wunterminated-string-initi > > alization] > >=20 > > FAIL: gcc.dg/Wunterminated-string-initialization.c (test for warnings,= line 5) > > ``` > >=20 > > And here's the test: > >=20 > > ``` > > /* { dg-do compile } */ > > /* { dg-options "-Wunterminated-string-initialization" } */ > >=20 > > char a1[] =3D "a"; > > char a2[1] =3D "a"; /* { dg-warning "unterminated char sequence" } */ > > char a3[2] =3D "a"; > > ``` > >=20 > > Why isn't it expecting the warning? >=20 > Because the text does not match the actual output above? Makes sense. Here's the output after a fix (which I'll send soon as a new revision): ``` output is: /home/alx/src/gnu/gcc/wustr/gcc/testsuite/gcc.dg/Wunterminated-string-initi= alization.c:5:14: warning: initializer-string for array of 'char' is too lo= ng [-Wunterminated-string-initialization] ``` and ``` =3D=3D=3D gcc Summary =3D=3D=3D # of expected passes 2 ``` The only thing that concerns me a little bit is that I don't see any PASS (or XFAIL). > You should see an additional FAIL for an excess warning. Yep, I did. Cheers, Alex >=20 > Martin >=20 >=20 >=20 >=20 --33sjkpsblsedcdbe Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE6jqH8KTroDDkXfJAnowa+77/2zIFAmUZWWkACgkQnowa+77/ 2zIbDQ/+LwhxrnpdC0tisH4dcsrWtzT1y16iLEptPVic+42+jgZsFAa/Eiy0dc3x onH9Q7Qol5nHjuUwUt/MWM8ekpMC9hNWi+9IbWp3C+mEBqwnpBuoUdR1WhJuJPtY JSNj3V/HK9DK4kMlAHyeM8MOuEIRytVLx/8nlHpQp8T5Si4SwYLGoxYrQU9kxIE0 XV8PfZBnlYLw3RtwoVriZsb2DaolMeePNmFUdWhKLp/AQlnD/tmqUWCjPv8FHGCC RUSBjIPSWW6X7Bk46obrlYsEdTMq8bNMQyOBmIA9iadjXQ2NeDwmw+cpRWslU7f6 ErYfqm55p8thoyOTrPQB99G5WuNwvnEWp+lLKSXxhNwLn2AuQbFCs1WfMiBPVcaa UFe0P6mxYTrmk7d1GQu3mUbW47kuFlIG/EykJ7agyerjM4iuUJTHc2mVQzCid6WJ u5EiPLoBoPJRSOUnyOFA8H5j3rWLjvzBzgsjv4eIlere5tHo7jI2xdqm/YyS0F6L 6QGkPb7mdZlwY/8OCW2aNUOv2iZyP/WLu13Ac2ouonTyHpAIIbHusi8DOUN2pgun BbxG1cWMuZLMdUkXrOghYctGsuFUHp0uKYbt38W4Le0c5qvfiGpafhPecpL84d3i IQDlMJ8N0wV4o8VcOs/WyMQPlmmkL8fDBg29hAjWK4pGYcVWzKM= =+OAT -----END PGP SIGNATURE----- --33sjkpsblsedcdbe--