From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa2.mentor.iphmx.com (esa2.mentor.iphmx.com [68.232.141.98]) by sourceware.org (Postfix) with ESMTPS id DD9573858C54 for ; Wed, 26 Apr 2023 23:34:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DD9573858C54 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.99,229,1677571200"; d="scan'208";a="4053772" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa2.mentor.iphmx.com with ESMTP; 26 Apr 2023 15:34:22 -0800 IronPort-SDR: lTBJszUQTaXQKIUD3CZFkwJVkNyO0MSfGVprSQm0l9zc0khQDKVf2Myd6ngYKaWAzt8GXY3cfw 4/SXPOQlM/sSK6yrzz4vdl70RxEgxB6g74S6g+63czWq/Q4uuLlikpXuhaBVPql4j0KCKGx/YG 08ZNaGWShWvNWF6vsWvevh3fyFcgZqTFEUfRVM2Rv1sVdcWUe7yr7599fjemgFt1pXniOeYNWH LOMltJZ6XuZZdAWPzkelRcofgqTpDPqgeJ9mXlEtT/A+J/abSGy4dVYUtlCwtbMgB6QwIEv0UD 9DY= Date: Wed, 26 Apr 2023 23:34:18 +0000 From: Joseph Myers To: Samuel Thibault CC: Subject: Re: Fix Hurd getcwd build with GCC >= 13 In-Reply-To: <20230426232939.thldgi44hctmadup@begin> Message-ID: References: <18587337-7815-4056-ebd0-724df262d591@codesourcery.com> <20230426232939.thldgi44hctmadup@begin> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-14.mgc.mentorg.com (139.181.222.14) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-3106.8 required=5.0 tests=BAYES_00,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,KAM_NUMSUBJECT,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Thu, 27 Apr 2023, Samuel Thibault wrote: > Well, it's actually not a genuine bug: the values of the file_namep > and file_name pointers are still coherent, so the subtraction is still > valid. But better please gcc 13 indeed, I have pushed it, thanks! It's a bug because "If a pointer value is used in an evaluation after the object the pointer points to (or just past) reaches the end of its lifetime, the behavior is undefined. The representation of a pointer object becomes indeterminate when the object the pointer points to (or just past) reaches the end of its lifetime." (N3096 wording, but the principle that you can't use pointers to deallocated memory, even without dereferencing them, dates back a lot further). -- Joseph S. Myers joseph@codesourcery.com