From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 2MhaIko6UGFEegAAWB0awg (envelope-from ) for ; Sun, 26 Sep 2021 05:15:54 -0400 Received: by simark.ca (Postfix, from userid 112) id 88BBB1EE25; Sun, 26 Sep 2021 05:15:54 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 927461EE23 for ; Sun, 26 Sep 2021 05:15:45 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5160E3858403 for ; Sun, 26 Sep 2021 09:15:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5160E3858403 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1632647744; bh=QXtFIbRhO9s2oP/GDZtvwL8yQqZ9GSTk6Ldqb8EaPF4=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=sMdHMfgte2oAUaQZGD4KInPsPD2TLhRYOlZceGm71G90yAbNDlhMFeERZQOmBl3cd F0ODS+p9Jy5C59rs2U3jbh0f/hLniC2d8wWQoFcSCllE5Yrx6Q+Y3KO9cwxmwtmATN eRlHNYYCMeaepan9SPggVNMNr3NjI2fGiiHBiVq0= Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 9B7993858403 for ; Sun, 26 Sep 2021 09:15:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9B7993858403 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id D68CB1FE8E; Sun, 26 Sep 2021 09:15:24 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id B8B1513AEF; Sun, 26 Sep 2021 09:15:24 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id I+qgKyw6UGGzOAAAMHmgww (envelope-from ); Sun, 26 Sep 2021 09:15:24 +0000 Date: Sun, 26 Sep 2021 11:15:23 +0200 To: gdb-patches@sourceware.org Subject: [PATCH][gdb/build] Fix build with g++-4.8 Message-ID: <20210926091521.GA31054@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Tom de Vries via Gdb-patches Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Hi, When building g++-4.8, we run into: ... src/gdb/dwarf2/read.c:919:5: error: multiple fields in union \ 'partial_die_info::' initialized ... This is due to: ... union { struct { CORE_ADDR lowpc = 0; CORE_ADDR highpc = 0; }; ULONGEST ranges_offset; }; ... The error looks incorrect, given that only one union member is initialized, and does not reproduce with newer g++. Nevertheless, work around this by moving the initialization to a constructor. [ I considered just removing the initialization, with the idea that access should be guarded by has_pc_info, but I ran into one failure in the testsuite, for gdb.base/check-psymtab.exp due to add_partial_symbol using lowpc without checking has_pc_info. ] Tested on x86_64-linux. Any comments? Thanks, - Tom [gdb/build] Fix build with g++-4.8 --- gdb/dwarf2/read.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index d2501c9dd56..00aa64dd0ab 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -920,8 +920,8 @@ struct partial_die_info : public allocate_on_obstack /* If HAS_PC_INFO, the PC range associated with this DIE. */ struct { - CORE_ADDR lowpc = 0; - CORE_ADDR highpc = 0; + CORE_ADDR lowpc; + CORE_ADDR highpc; }; /* If HAS_RANGE_INFO, the ranges offset associated with this DIE. */ ULONGEST ranges_offset; @@ -974,6 +974,10 @@ struct partial_die_info : public allocate_on_obstack is_dwz = 0; spec_is_dwz = 0; canonical_name = 0; + /* Don't set these using NSDMI (Non-static data member initialisation), + because g++-4.8 will error out. */ + lowpc = 0; + highpc = 0; } };