From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18395 invoked by alias); 21 Jul 2010 18:00:45 -0000 Received: (qmail 18256 invoked by uid 48); 21 Jul 2010 18:00:15 -0000 Date: Wed, 21 Jul 2010 18:00:00 -0000 Message-ID: <20100721180015.18255.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c/45020] Useless DW_TAG_variable generated In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "jakub 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: 2010-07/txt/msg02249.txt.bz2 ------- Comment #1 from jakub at gcc dot gnu dot org 2010-07-21 18:00 ------- Another testcase: extern int v; extern __typeof (v) v; extern __typeof (v) v; When the old extern decl isn't TREE_USED, it doesn't make it into debug info: case VAR_DECL: /* Ignore this VAR_DECL if it refers to a file-scope extern data object declaration and if the declaration was never even referenced from within this entire compilation unit. We suppress these DIEs in order to save space in the .debug section (by eliminating entries which are probably useless). Note that we must not suppress block-local extern declarations (whether used or not) because that would screw-up the debugger's name lookup mechanism and cause it to miss things which really ought to be in scope at a given point. */ if (DECL_EXTERNAL (decl) && !TREE_USED (decl)) return; I wonder if there is any point in keeping TREE_USED set on olddecl after merge_decls if olddecl was DECL_EXTERNAL. If there is, other options could be DECL_IGNORED_P on the DECL_EXTERNAL olddecl, or redirecting it to the newdecl. -- jakub at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |roland at redhat dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45020