From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 524B53858C66; Mon, 27 Mar 2023 14:50:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 524B53858C66 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1679928655; bh=A6AYG7m6Ri7vfiErHbiOrotW8bE6MNx8ufHDiQuNTOs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Vf3/EBSpZJQM4f2jWZd5MzQc82XbqKQj3Vet2rjqxeArOvxry95ROwDDGHoYBlc47 CXzMhEegjmQ4cepa99BBFFNcY/EwEtV1vp0a6S5LqPPgkwjW6oZKSQeKkU1meBaBs7 bwuk3oSpj8V0yPZ31qg4ARW2bZqhtoSd9HEo9Gh4= From: "tromey at sourceware dot org" To: gdb-prs@sourceware.org Subject: [Bug gdb/30278] gdb gives wrong value at -O1 Date: Mon, 27 Mar 2023 14:50:54 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: tromey at sourceware dot 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: cf_reconfirmed_on everconfirmed bug_status cc 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=3D30278 Tom Tromey changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2023-03-27 Ever confirmed|0 |1 Status|UNCONFIRMED |NEW CC| |tromey at sourceware dot o= rg --- Comment #1 from Tom Tromey --- I wrote a long thing here about how this is the compiler's fault, but now I see there really is a gdb bug. "i" has a location list: (gdb) info addr i Symbol "i" is multi-location: Base address 0x401106 Range 0x401106-0x401106: a complex DWARF expressio= n: 0: DW_OP_lit0 1: DW_OP_stack_value Range 0x401106-0x401106: a complex DWARF expression: 0: DW_OP_lit1 1: DW_OP_stack_value Range 0x401106-0x401106: a complex DWARF expression: 0: DW_OP_lit2 1: DW_OP_stack_value Range 0x401106-0x401106: a complex DWARF expression: 0: DW_OP_lit3 1: DW_OP_stack_value Range 0x401106-0x401106: a complex DWARF expression: 0: DW_OP_lit4 1: DW_OP_stack_value Range 0x401106-0x401106: a complex DWARF expression: 0: DW_OP_lit5 1: DW_OP_stack_value Range 0x401106-0x401106: a complex DWARF expression: 0: DW_OP_lit6 1: DW_OP_stack_value Range 0x401106-0x401106: a complex DWARF expression: 0: DW_OP_lit7 1: DW_OP_stack_value Range 0x401106-0x401116: a complex DWARF expression: 0: DW_OP_lit8 1: DW_OP_stack_value And the PC is: (gdb) p $pc $2 =3D (void (*)()) 0x401106 gdb should be picking the last location in that list, because the=20 upper bound is exclusive, not inclusive. All those other entries are dead. --=20 You are receiving this mail because: You are on the CC list for the bug.=