From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A869F3857823; Fri, 12 Mar 2021 16:31:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A869F3857823 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug debug/99562] Invalid debug info: objdump: Warning: Location list starting at offset 0x9c3 is not terminated. Date: Fri, 12 Mar 2021 16:31:56 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: debug X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.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://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 16:31:56 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99562 --- Comment #2 from Jakub Jelinek --- Caused by the (IMHO incorrect) PR66728 changes. We have 2 spots that fill in dw_loc_oprnd?.v.val_wide: mem_loc_result =3D new_loc_descr (dwarf_OP (DW_OP_const_type), 0,= 0); mem_loc_result->dw_loc_oprnd1.val_class =3D dw_val_class_die_ref; mem_loc_result->dw_loc_oprnd1.v.val_die_ref.die =3D type_die; mem_loc_result->dw_loc_oprnd1.v.val_die_ref.external =3D 0; mem_loc_result->dw_loc_oprnd2.val_class =3D dw_val_class_wide_int; mem_loc_result->dw_loc_oprnd2.v.val_wide =3D ggc_alloc = (); *mem_loc_result->dw_loc_oprnd2.v.val_wide =3D rtx_mode_t (rtl, mo= de); and loc_result =3D new_loc_descr (DW_OP_implicit_value, GET_MODE_SIZE (int_mode), 0); loc_result->dw_loc_oprnd2.val_class =3D dw_val_class_wide_int; loc_result->dw_loc_oprnd2.v.val_wide =3D ggc_alloc (); *loc_result->dw_loc_oprnd2.v.val_wide =3D rtx_mode_t (rtl, int_mo= de); and 3 callers of add_AT_wide: case CONST_WIDE_INT: { wide_int w1 =3D rtx_mode_t (rtl, MAX_MODE_INT); unsigned int prec =3D MIN (wi::min_precision (w1, UNSIGNED), (unsigned int)CONST_WIDE_INT_NUNITS (rtl) * HOST_BITS_PER_WIDE_INT); wide_int w =3D wi::zext (w1, prec); add_AT_wide (die, DW_AT_const_value, w); } and else if (dwarf_version >=3D 5 && TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (value))) =3D=3D 1= 28) /* Otherwise represent the bound as an unsigned value with the precision of its type. The precision and signedness of the type will be necessary to re-interpret it unambiguously. */ add_AT_wide (die, attr, wi::to_wide (value)); and else /* Enumeration constants may be wider than HOST_WIDE_INT. Hand= le that here. TODO: This should be re-worked to use correct signed/unsigned double tags for all cases. */ add_AT_wide (enum_die, DW_AT_const_value, wi::to_wide (value)); Now, I think the PR66728 changes fixed the first add_AT_wide case (iff GET_= MODE (rtl) is VOIDmode only) but at the same time broke all the other 4 cases, w= hich really expect that the constants in the debug info will have the expected length. Some cases like the DW_OP_implicit_value we're hitting here explic= itly on the producer size, as it fills in the size of the constant.=