From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9567E3858C33; Thu, 20 Jul 2023 06:48:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9567E3858C33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1689835708; bh=3KvX2yRBIEt8U5GGk+5LG5SjkSGwI/8PgOKrMz0sqTk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=py6q6vkmjgRfroP6orKvud6WDb7f2NVrbjdFZrMRIgpLr3RUqNkUINjh1/zLw9Ba5 aDGe0sm6wbFWvhpU7OfWaCazVnzdNYlfMhWuqZ5S80Qg8gT7zOYFkCJeoRF+w514Vx ALS940zaeWLz4H3xq8cW8969Yz4KIzgDe4kGKtms= From: "vries at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug symtab/30656] [gdb/symtab] optimized out static handled inconsistently Date: Thu, 20 Jul 2023 06:48:28 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: symtab X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vries at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D30656 --- Comment #2 from Tom de Vries --- (In reply to Tom de Vries from comment #0) > I wrote a dwarf assembly test-case simulating an optimized-out static > variable: Also reproduced with a plain C test-case: ... $ cat whole-program.c static int aaa; int main (void) { return 0; } $ gcc-12 whole-program.c -g -flto -O2 $ nm a.out | grep aaa $ ... Corresponding DIE: ... <1><104>: Abbrev Number: 2 (DW_TAG_variable) <105> DW_AT_name : aaa <109> DW_AT_decl_file : 1 <10a> DW_AT_decl_line : 1 <10b> DW_AT_decl_column : 12 <10c> DW_AT_type : <0x110> ... Difference in behaviour: .... $ gdb -q -batch ./a.out -ex "print aaa" No symbol "aaa" in current context. $ gdb -q -batch -readnow ./a.out -ex "print aaa" $1 =3D ... --=20 You are receiving this mail because: You are on the CC list for the bug.=