From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by sourceware.org (Postfix) with ESMTPS id BC3923857737 for ; Fri, 1 Sep 2023 13:17:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BC3923857737 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 (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 20A11CE224C; Fri, 1 Sep 2023 13:17:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0BD6C433C7; Fri, 1 Sep 2023 13:17:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1693574240; bh=CP+PaVQLFh5WvssgX56o9xuASkwcNqynkPu28z/vEvU=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=iE4e8qfDmo0aFeRNYS0zxzZ15+CxtaPP6tK2tzWdX0kyW3JBXylLoAOnGgUFY0CAQ onNcrUfnbekh4m059caKALj0MMJ1qhsRyhI0wi7e3JlElqixEdcKpbwwjl5x20oinR /W07hJNFxQzpI74aFqoq8T5p1oox2it9ZPZfi242YVOb+r55BMhcpIgAL05RHZ+hWM bAaFKL1+em1Os9JeqrQ+TU/V2Y7FL3AsuT6Co0pknMPhsYjw7j8x9LVidW3cquR9PF 3SRBXHYvMmLPq8pLiqnmmAcF2WKa/Aecxu1wbGy2ZUapM/3d71OVmAIU8UTDt1stRg 3yJxkSmHL6x0A== Message-ID: Date: Fri, 1 Sep 2023 15:17:08 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.1 Subject: Re: Confusing location of error in source code To: Jonathan Wakely Cc: GCC References: Content-Language: en-US From: Alejandro Colomar Organization: Linux In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------KnyDLI4oMuvZVF0KsNMQH6ts" X-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,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: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --------------KnyDLI4oMuvZVF0KsNMQH6ts Content-Type: multipart/mixed; boundary="------------fkPMFj47bNV5cR7uz4MLeF6I"; protected-headers="v1" From: Alejandro Colomar To: Jonathan Wakely Cc: GCC Message-ID: Subject: Re: Confusing location of error in source code References: In-Reply-To: --------------fkPMFj47bNV5cR7uz4MLeF6I Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Jonathan, On 2023-09-01 08:49, Jonathan Wakely wrote: > On Thu, 31 Aug 2023, 17:05 Alejandro Colomar via Gcc, = > wrote: >=20 >> Hi! >> >> I've been confused for some time with a compilation error that >> pointed to a slightly-off location. I wasn't seeing that I used >> a temporary variable in a constant expression. The code could be >> reduced to: >> >> $ cat const.c >> int >> main(void) >> { >> int x =3D 42; >> >> _Static_assert(0 || 7 > x, ""); >> } >> $ cc -Wall -Wextra const.c >> const.c: In function =E2=80=98main=E2=80=99: >> const.c:6:26: error: expression in static assertion is not constant >> 6 | _Static_assert(0 || 7 > x, ""); >> | ~~^~~~~~~~ >> >> >> I think the appropriate error report should point to this other point:= >> >> >> 6 | _Static_assert(0 || 7 > x, ""); >> | ~~~~~~~~~^ >> >=20 > Please use bugzilla for bug reports. Sure, will do. Thanks! Alex >=20 --=20 GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5 --------------fkPMFj47bNV5cR7uz4MLeF6I-- --------------KnyDLI4oMuvZVF0KsNMQH6ts Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE6jqH8KTroDDkXfJAnowa+77/2zIFAmTx5FQACgkQnowa+77/ 2zKdvA/7BhvOxNHQ9inrmaSMPyazfSSsMCgMmUfBUCiXqutU+0zJbrng/hoknj55 y+M8GUitPyqJHq0H9NLKFO89HEb5kcxecuC8YWb/ngcFU5z21qlo3PR9PFA5F1cI G1MGBeEM2Xj07t2CesiBi7kO48ij3HayKF8sdUPDvC8OqBklHjk11tIc5zFNsyYb +fyL66upkPIhWWVmLf1KVqNBSyzyGhW19pjtd2iZ3riXOOQRKbLYNzxlcl26fyQy NeF6tJ2TTAZ75iF+FHYwQiXtHvsi+jbiltU5KzUn4opWbiYphDLwqWDmWQ1w62cU jKzkleZYMgV+AwnptJm3W/QwsidSIXxVuGC/q9+uYI2yOOeIKXwKEDolprF8JhNo bwH8YL3LS1fIIzahwvOVEvmLERCpWMWDBh73k9Ip+v0QMmcmdLagwFvOx7Q3KM2T U24RG2xR22UJNbeL1Ux6t19C4/FawGWB5nt5SbauH7ccut+21OGyWkHqsyG7GnEl d1BdcKCyNoyPvI+91WgyYVY3tAUEHVUlF8oM3s8Np5ZtIMYWPJJ2+0RRer1bBZdC aHtdJBiJsFJW/0++wtqI+PnUrNTezDgm4dp7R00RmyVnwpiUfgfd2QA8vp40f0o1 nU0CJW8e8pg3RD92RsaoK8BfNJJz0C9+HeO3TeO2URf9b/rFo80= =swN5 -----END PGP SIGNATURE----- --------------KnyDLI4oMuvZVF0KsNMQH6ts--