From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 980 invoked by alias); 7 Feb 2007 23:33:36 -0000 Received: (qmail 937 invoked by uid 48); 7 Feb 2007 23:33:20 -0000 Date: Wed, 07 Feb 2007 23:33:00 -0000 Message-ID: <20070207233320.936.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug tree-optimization/30562] [4.3 Regression] remove unused variable is removing a referenced variable (in STORED_SYMS or LOADED_SYMS) In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "dnovillo at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2007-02/txt/msg00909.txt.bz2 ------- Comment #5 from dnovillo at gcc dot gnu dot org 2007-02-07 23:33 ------- I cannot reproduce this bug with mainline as of 2007-02-06. The bug is still latent though, so I will commit a variant of this patch to fix it. Essentially, we should leave every TREE_ADDRESSABLE variable alone so that it can be removed by a subsequent may_alias pass: Index: tree-ssa-live.c =================================================================== --- tree-ssa-live.c (revision 121699) +++ tree-ssa-live.c (working copy) @@ -502,18 +502,20 @@ cell = &TREE_CHAIN (*cell); } - /* Remove unused variables from REFERENCED_VARs. As an special exception - keep the variables that are believed to be aliased. Those can't be - easily removed from the alias sets and and operand caches. - They will be removed shortly after next may_alias pass is performed. */ + /* Remove unused variables from REFERENCED_VARs. As a special + exception keep the variables that are believed to be aliased. + Those can't be easily removed from the alias sets and operand + caches. They will be removed shortly after the next may_alias + pass is performed. */ FOR_EACH_REFERENCED_VAR (t, rvi) if (!is_global_var (t) && !MTAG_P (t) && TREE_CODE (t) != PARM_DECL && TREE_CODE (t) != RESULT_DECL && !(ann = var_ann (t))->used - && !ann->is_aliased && !is_call_clobbered (t) && !ann->symbol_mem_tag) - remove_referenced_var (t); + && !ann->symbol_mem_tag + && !TREE_ADDRESSABLE (t)) + remove_referenced_var (t); } -- dnovillo at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |WORKSFORME http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30562