From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id E39D13858D35 for ; Sat, 8 Aug 2020 21:35:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E39D13858D35 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tdevries@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id C07A5ACC8; Sat, 8 Aug 2020 21:35:26 +0000 (UTC) Date: Sat, 8 Aug 2020 23:35:06 +0200 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [committed][gdb/build] Fix missing implicit constructor call with gcc 4.8 Message-ID: <20200808213504.GA28308@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-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_NUMSUBJECT, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: , X-List-Received-Date: Sat, 08 Aug 2020 21:35:10 -0000 Hi, When building gdb on x86_64-linux with --enable-targets riscv64-suse-linux, I run into: ... src/gdb/arch/riscv.c:112:45: required from here /usr/include/c++/4.8/bits/hashtable_policy.h:195:39: error: no matching \ function for call to 'std::pair >::pair(const \ riscv_gdbarch_features&, target_desc*&)' : _M_v(std::forward<_Args>(__args)...) { } ^ ... for this code in riscv_lookup_target_description: ... /* Add to the cache. */ riscv_tdesc_cache.emplace (features, tdesc); ... Work around this compiler problem (filed as PR gcc/96537), similar to how that was done in commit 6d0cf4464e "Fix build with gcc-4.8.x": ... - riscv_tdesc_cache.emplace (features, tdesc); + riscv_tdesc_cache.emplace (features, target_desc_up (tdesc)); ... That is, call the target_desc_up constructor explictly instead of implicitly. Also, work around a similar issue in get_thread_arch_aspace_regcache. Build on x86_64-linux with --enable-targets riscv64-suse-linux, and reg-tested. Committed to trunk. Thanks, - Tom [gdb/build] Fix missing implicit constructor call with gcc 4.8 gdb/ChangeLog: 2020-08-08 Tom de Vries PR build/26344 * arch/riscv.c (riscv_lookup_target_description): Use an explicit constructor. * regcache.c (get_thread_arch_aspace_regcache): Same. --- gdb/arch/riscv.c | 5 +++-- gdb/regcache.c | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/gdb/arch/riscv.c b/gdb/arch/riscv.c index e43aafc1c2..8f5709092e 100644 --- a/gdb/arch/riscv.c +++ b/gdb/arch/riscv.c @@ -108,8 +108,9 @@ riscv_lookup_target_description (const struct riscv_gdbarch_features features) target_desc *tdesc = riscv_create_target_description (features); - /* Add to the cache. */ - riscv_tdesc_cache.emplace (features, tdesc); + /* Add to the cache. Work around a problem with g++ 4.8 (PR96537): + Call the target_desc_up constructor explictly instead of implicitly. */ + riscv_tdesc_cache.emplace (features, target_desc_up (tdesc)); return tdesc; } diff --git a/gdb/regcache.c b/gdb/regcache.c index b8fcc52860..cd54bc6b5f 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -354,7 +354,9 @@ get_thread_arch_aspace_regcache (process_stratum_target *target, /* It does not exist, create it. */ regcache *new_regcache = new regcache (target, arch, aspace); new_regcache->set_ptid (ptid); - ptid_regc_map.insert (std::make_pair (ptid, new_regcache)); + /* Work around a problem with g++ 4.8 (PR96537): Call the regcache_up + constructor explictly instead of implicitly. */ + ptid_regc_map.insert (std::make_pair (ptid, regcache_up (new_regcache))); return new_regcache; }