From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by sourceware.org (Postfix) with ESMTPS id D8132392AC33 for ; Thu, 26 Jan 2023 19:18:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D8132392AC33 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=google.com Received: by mail-wr1-x434.google.com with SMTP id r2so2796968wrv.7 for ; Thu, 26 Jan 2023 11:18:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=X+FXevZbU263xKzc8xxbTcK+jGH9OcDEERmEIvK1WbY=; b=sYpac38zXw0sgAwDHHXbRJuwVpFbUyQbW6PPhpVJC2wOnEHsHyCcInGFAlOwzuoJSD afYyGeEXLCJU4B6pZrDg7m7pMBqlW/sjftueQUctXri2alVOqF4mWCE66uZKVg572vzm hovoG+JwC5w5KnQbtQsObpdT5usxAjICXG9rOJ1xFUKtKYYMJRxAGuq0DMclT3kWju+o pliyCwK4p50pn31GhQcPDITmJsmfdtdEQllGxD5zlncCoys5TKwfRRQpargfOex3TsWe wwX/8KOmcpAF318IKHr8BdqZyJjmxHiIzPEOwawXqH8PyKtTUHR2Wcm06cOyI24cK1Ac op/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=X+FXevZbU263xKzc8xxbTcK+jGH9OcDEERmEIvK1WbY=; b=OdBud8HjvhcbnGgtbgTjp3oZOpvQ5Cf+H2B7QQwYW5kqqGV5nHofd4icB6c3vOikjA cRnftvdiISnnUqZwsPbImkwKEpeHahKNahselwhGj7pFWHXAzpMnhT4Wh4ZZ6pxWlZiS hUz6h9qKl2UuzKIZE1UzHVdT5P7yPmMM6YgKZ3QMOEMRgZswwj0I+7xtVKxJGD9Ny4EA OXptGLxwkZofkYQCvgJXdiKVpTUjwm2CiZjMJ2+HqW1Vsi+8JTHv9NN4jfo031jI9+UD 6lUU33UB7JcggYSw5tOYhv1tZDBTh5fhkkVO8nMJ/dpFACpyu07Wbsdv6PnaL8YRtCof 28zg== X-Gm-Message-State: AO0yUKXR+8JXLYT4YvxYN1mhVdlJ2kA1W9lHV9dXo1hlQEJfLUgT+7LO su7ealpa7ZszZB+88l0BWUQPkWIO7QSjhVw4DxR+Dg== X-Google-Smtp-Source: AK7set/0KDvm+3pFr4jKOkIwDKrcKfy1W3AgPXqzM2gARcuMWb3lZ8ULgKp8vbjIqpwO/HWrFr3X0eppgJw3H+g3k1E= X-Received: by 2002:a5d:4392:0:b0:2bf:c260:692e with SMTP id i18-20020a5d4392000000b002bfc260692emr165284wrq.172.1674760728380; Thu, 26 Jan 2023 11:18:48 -0800 (PST) MIME-Version: 1.0 References: <871qnlfhtv.fsf@oldenburg.str.redhat.com> <20230124111019.GC3298@brightrain.aerifal.cx> <878rhsgoxn.fsf@oldenburg.str.redhat.com> <20230124112307.GE3298@brightrain.aerifal.cx> <87zga8f83f.fsf@oldenburg.str.redhat.com> In-Reply-To: From: Paul Pluzhnikov Date: Thu, 26 Jan 2023 11:18:19 -0800 Message-ID: Subject: Re: [patch] Use __builtin_FILE and __builtin_LINE in assert implementation in C++ To: Jonathan Wakely Cc: Szabolcs Nagy , Florian Weimer , Rich Felker , Paul Pluzhnikov via Libc-alpha Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-19.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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: On Tue, Jan 24, 2023 at 7:51 AM Jonathan Wakely wrote: > > On Tue, 24 Jan 2023 at 15:08, Szabolcs Nagy wrote: > > is that a real fix? the token sequence is the same in different > > TUs with the builtins but the actual printed path is different, > > so if the linker picks a definition at random then the produced > > binary is not deterministic. Any given binary is deterministic (the linker picks one or the other version), but rebuilding this binary again after unrelated changes may change the output, yes. > In practice, that only happens if you copy & paste the inline function > definition so it appears in two different TUs. That doesn't seem correct. As the original example shows, the same "a.h" can be #included differently in different TUs, and either __FILE__ or __builtin_FILE() will give different output in these TUs. -- Paul Pluzhnikov