From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22954 invoked by alias); 1 Mar 2011 14:11:43 -0000 Received: (qmail 22944 invoked by uid 22791); 1 Mar 2011 14:11:42 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_CX X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 01 Mar 2011 14:11:37 +0000 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/47939] Missing DW_TAG_typedef for qualified types X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Keywords: wrong-debug X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Status Last reconfirmed CC Component Ever Confirmed Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Tue, 01 Mar 2011 14:11:00 -0000 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: 2011-03/txt/msg00079.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47939 Richard Guenther changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2011.03.01 14:11:28 CC| |jsm28 at gcc dot gnu.org Component|debug |c Ever Confirmed|0 |1 --- Comment #1 from Richard Guenther 2011-03-01 14:11:28 UTC --- Happens because when finishing the TYPE_DECL if (is_naming_typedef_decl (decl)) /* We want that all subsequent calls to lookup_type_die with TYPE in argument yield the DW_TAG_typedef we have just created. */ equate_type_number_to_die (type, type_die); returns false. Which is because is_cxx () is returning false. The VAR_DECL itself is not using the type-def id: unit size align 32 symtab -172776352 alias set -1 canonical type 0x7ffff5b2a498 fields SI file t.c line 1 col 36 size unit size align 32 offset_align 128 offset bit offset context > context > readonly asm_written public static common SI file t.c line 2 col 10 size unit size align 32 context (mem/s/u/c:SI (symbol_ref:DI ("george") ) [0 george+0 S4 A32])> already grokdeclarator creates this by re-applying qualifiers via if (!flag_gen_aux_info && (TYPE_QUALS (element_type))) type = TYPE_MAIN_VARIANT (type); type_quals = ((constp ? TYPE_QUAL_CONST : 0) | (restrictp ? TYPE_QUAL_RESTRICT : 0) | (volatilep ? TYPE_QUAL_VOLATILE : 0) | ENCODE_QUAL_ADDR_SPACE (address_space)); and 6010 type = c_build_qualified_type (type, type_quals); thereby stripping all uses of typedef ids. Thus, it doesn't seem to distinguish between qualifiers applied at the declaration and qualifiers that are part of the typedef. c_build_qualified_type would handle choosing a variant with the same name just fine - but we feed it the main variant instead of the original type. Index: gcc/c-decl.c =================================================================== --- gcc/c-decl.c (revision 170589) +++ gcc/c-decl.c (working copy) @@ -6007,7 +6007,7 @@ grokdeclarator (const struct c_declarato /* An uninitialized decl with `extern' is a reference. */ int extern_ref = !initialized && storage_class == csc_extern; - type = c_build_qualified_type (type, type_quals); + type = c_build_qualified_type (declspecs->type, type_quals); /* C99 6.2.2p7: It is invalid (compile-time undefined behavior) to create an 'extern' declaration for a fixes this particular testcase. Joseph?