From patchwork Fri May 30 13:00:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Enkovich X-Patchwork-Id: 354172 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id EC1551400DB for ; Fri, 30 May 2014 23:01:15 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=CNLCEmCgwwyE2FTcnKmd+eIQY92RT+MCdQTGbVst2jjwGUalcX/lr MKJfFPkMVLQDdlxRNZJe/Kl1lqVOxBH2LsNqSpzSr93t1cCJIZ0r3by9SJcFae+p h55/192Jj3cVQ9uoZG/+gq5eefUVJCoo6SvGzFMwJVn6k4hZFcbICM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=b69PPs2pCOcuKZTsK4SWfS480J0=; b=LXDv0Xc5nJlfoK1FVX0z gFDV1maU/9T3foX9j1i4tzm9OMXx9Rvd5xP6kAW7v8oC7bziB76mip46JdPYmz5f wPKeBxKlv2/i1+CoPQ795TM+JtYKEB+SxQBGaMImXBj06i7TSWZZIP8yntqLhegp ggvchz+AxfcRAmHd75sZNDw= Received: (qmail 11486 invoked by alias); 30 May 2014 13:01:09 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 11477 invoked by uid 89); 30 May 2014 13:01:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f45.google.com Received: from mail-pa0-f45.google.com (HELO mail-pa0-f45.google.com) (209.85.220.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 30 May 2014 13:01:06 +0000 Received: by mail-pa0-f45.google.com with SMTP id ey11so1686596pad.32 for ; Fri, 30 May 2014 06:01:05 -0700 (PDT) X-Received: by 10.67.12.171 with SMTP id er11mr590693pad.132.1401454865231; Fri, 30 May 2014 06:01:05 -0700 (PDT) Received: from msticlxl57.ims.intel.com ([192.55.55.41]) by mx.google.com with ESMTPSA id ee5sm6376801pbc.47.2014.05.30.06.01.03 for (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 30 May 2014 06:01:04 -0700 (PDT) Date: Fri, 30 May 2014 17:00:59 +0400 From: Ilya Enkovich To: gcc-patches@gcc.gnu.org Subject: [PATCH, Pointer Bounds Checker 16/x] Register statically initialized pointers Message-ID: <20140530130059.GB45878@msticlxl57.ims.intel.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Hi, This patchs registers all statically initialized vars in Pointer Bounds Checker. It allows to build proper Bounds Tables for statically initialized pointers. Bootstrapped and tested on linux-x86_64. Thanks, Ilya --- gcc/ 2014-05-30 Ilya Enkovich * cgraphunit.c: Include tree-chkp.h. (varpool_finalize_decl): Register statically initialized decls in Pointer Bounds Checker. diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index ceb4060..c5c3333 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -210,6 +210,7 @@ along with GCC; see the file COPYING3. If not see #include "pass_manager.h" #include "tree-nested.h" #include "gimplify.h" +#include "tree-chkp.h" /* Queue of cgraph nodes scheduled to be added into cgraph. This is a secondary queue used during optimization to accommodate passes that @@ -839,6 +840,9 @@ varpool_finalize_decl (tree decl) if (cgraph_state == CGRAPH_STATE_FINISHED || (!flag_toplevel_reorder && cgraph_state == CGRAPH_STATE_EXPANSION)) varpool_assemble_decl (node); + + if (DECL_INITIAL (decl)) + chkp_register_var_initializer (decl); } /* EDGE is an polymorphic call. Mark all possible targets as reachable