From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ipv6.s8.linuxpl.com (ipv6.s8.linuxpl.com [IPv6:2a02:1778:113::201]) by sourceware.org (Postfix) with ESMTPS id 7C3A23858D3C for ; Fri, 4 Mar 2022 16:07:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7C3A23858D3C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=lach.art.pl Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=lach.art.pl DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lach.art.pl ; s=x; h=Content-Type:Content-Transfer-Encoding:MIME-Version:Message-ID:Date: Subject:To:From:Sender:Reply-To:Cc:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=ert7HwMOEGXKpk9KK74JJE3Ms6Pk/duCpGv4ofDz6iU=; b=U a7WZPtm5j1GGfBx5jl/lCUMr8CszSwaYm4pOBW9q7nz73dKPO286fu+dqvSg7VKvmNoPxAcqFyqcm dZvYH9PyIbcMoV8ebkFtK7z/i/nYbrOhF41gdeBv6QKMVSbHu135sWdolLr4k1ZlrQvLDgEJ2HnSl cgYfBhcZg9ESlslfq08Ssm6Qz3mglRPa3CDk7gGpWMKrDeqdGeBhsGOKd+EvRgSa/S1THL4XNXwgv Mf5NUG+SOeSXEpXHYDR+uAQW2u2aHtMVrXrNc75gHUG177da1xu3GH5M5AZlHAGc7Q9Fm3vDP9ovR UfxMFi+D8SF/3qtrqGpLePjWSVJMjtZwA==; Received: from apn-95-41-249-214.dynamic.gprs.plus.pl ([95.41.249.214] helo=localhost.localdomain) by s8.linuxpl.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1nQASM-006uQf-Ib for gcc@gcc.gnu.org; Fri, 04 Mar 2022 17:07:02 +0100 From: =?utf-8?B?U8WCYXdvbWly?= Lach To: gcc@gcc.gnu.org Subject: Save/Store information, which variable are not initialized Date: Fri, 04 Mar 2022 17:06:56 +0100 Message-ID: <6982211.xGEPP2f2DN@localhost.localdomain> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Authenticated-Id: slawek@lach.art.pl X-Spam-Status: No, score=0.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_BARRACUDACENTRAL, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Mar 2022 16:07:08 -0000 I known, IDE will detect cases, whereas variable is not initialized, but some developers still have problems with variable initialization. I suppose gcc do not support any run-time sanitizer, because I do not found any information. So: gcc will introduce hidden array of variables for each context. One bit stores information about one variable in current scope. So, if it is set - variable was initialized. In other case, variable is not initialized. When new scope is created, gcc will allocate this array and set each element to 0. When program set variable, also bit is set. Each structure will contains this array at top of self. GCC must hack access to this struct in some way. That is big problem to handle this case, because some languages allow to free memory access. Maybe for struct store information about fields state in different part of memory? Idea was inspired by way to detect cases, where return address was written. Programmer should compile program with special switch to enable this mode. GDB could support this feature of gcc and read, which variable was not set.