From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.ispras.ru (mail.ispras.ru [83.149.199.84]) by sourceware.org (Postfix) with ESMTPS id 67F8F3858D35 for ; Tue, 21 Nov 2023 07:59:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 67F8F3858D35 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=ispras.ru Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=ispras.ru ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 67F8F3858D35 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=83.149.199.84 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700553595; cv=none; b=cUxK8CpHC1uYPqOhwf2d1df1MSw318wS0EXV8FPdyZakC+coCRzit+mp33cc4xqHJkVYAqZqTQ/asleDFAa06fH1LARkJuF2eL3/G0z7Kjqlx1fOd/LfN9LOsdUhKzGJ8vZxtcKppoLmwyDykc8p13wt/6bf3zEHy5ibAuYQ7vQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700553595; c=relaxed/simple; bh=uRYicZXHkyxmouukPyh/3gYe6X0blFoX4STjszuO9zA=; h=Date:From:To:Subject:Message-ID:MIME-Version; b=ORZJeDmxf7HYDaKlZMn9wye3W8PlanfilhgzkPvFCQVpJYae9n3TVVdfk3M+EJLWPNKbU515+HuHhm9x5GCEEcPkhYVnHFPqeWGT352WJ5p/d6Zs9hq7M4X+3Rf6dBdy2o30xYZqpYl3yDH5JkOgrWYL2GbA/iGW9LanwOEBOp0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from [10.10.3.121] (unknown [10.10.3.121]) by mail.ispras.ru (Postfix) with ESMTPS id E6CFF40737A9; Tue, 21 Nov 2023 07:59:52 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.ispras.ru E6CFF40737A9 Date: Tue, 21 Nov 2023 10:59:52 +0300 (MSK) From: Alexander Monakov To: Richard Biener cc: exactlywb@ispras.ru, gcc-patches@gcc.gnu.org Subject: Re: [RFC PATCH] Detecting lifetime-dse issues via Valgrind In-Reply-To: <53557793-8cc8-1240-2848-09b4895e96c9@ispras.ru> Message-ID: References: <207796F2-6AA2-4976-B0FD-50A08B8A56E4@gmail.com> <53557793-8cc8-1240-2848-09b4895e96c9@ispras.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,KAM_DMARC_STATUS,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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, 21 Nov 2023, Alexander Monakov wrote: > I am concerned that if GCC ever learns to leave out the following access > to 'this->foo', leaving tmp uninitialized, we will end up with: > > this->foo = 42; Sorry, this store will be DSE'd out, of course, but my question stands. Alexander > *this = { CLOBBER }; > __valgrind_make_mem_undefined(this, sizeof *this); > int tmp(D); > return tmp(D); // uninitialized > > and Valgrind will not report anything since the invalid load is optimized out. > > With early instrumentation such optimization is not going to happen, since the > builtin may modify *this. > > Is my concern reasonable? > > Thanks. > Alexander