Bug 27385 - Cannot compile arc.c with gcc-4.8 (error: no matching function for call to 'std::pair...')
Summary: Cannot compile arc.c with gcc-4.8 (error: no matching function for call to 's...
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: build (show other bugs)
Version: 10.1
: P2 normal
Target Milestone: 10.2
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-09 08:30 UTC by Shahab
Modified: 2021-11-23 09:00 UTC (History)
26 users (show)

See Also:
Host: x86_64-pc-linux-gnu
Target: arc-snps-linux-uclibc
Build: x86_64-pc-linux-gnu
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Shahab 2021-02-09 08:30:03 UTC
This PR is suffering from the same problem as "PR build/26344":

--------8<---------
../../gdb/arch/arc.c:117:43:   required from here
/usr/include/c++/4.8.2/bits/hashtable_policy.h:195:39: error: no matching function for call to ‘std::pair<const arc_arch_features, const std::unique_ptr<target_desc, target_desc_deleter> >::pair(const arc_arch_features&, target_desc*&)’
  : _M_v(std::forward<_Args>(__args)...) { }
                                       ^
/usr/include/c++/4.8.2/bits/hashtable_policy.h:195:39: note: candidates are:
In file included from /usr/include/c++/4.8.2/utility:70:0,
                 from /usr/include/c++/4.8.2/tuple:38,
                 from /usr/include/c++/4.8.2/functional:55,
                 from ../../gdb/../gdbsupport/ptid.h:35,
                 from ../../gdb/../gdbsupport/common-defs.h:123,
                 from ../../gdb/arch/arc.c:19:
/usr/include/c++/4.8.2/bits/stl_pair.h:206:9: note: template<class ... _Args1, long unsigned int ..._Indexes1, class ... _Args2, long unsigned int ..._Indexes2> std::pair<_T1, _T2>::pair(std::tuple<_Args1 ...>&, std::tuple<_Args2 ...>&, std::_Index_tuple<_Indexes1 ...>, std::_Index_tuple<_Indexes2 ...>)
         pair(tuple<_Args1...>&, tuple<_Args2...>&,
         ^
-------->8---------

Thanks to Tome de Vries' investigation, same fix applies in ARC's case as well:
--------8<---------
diff --git a/gdb/arch/arc.c b/gdb/arch/arc.c
index 3808f9f..a5385ce 100644
--- a/gdb/arch/arc.c
+++ b/gdb/arch/arc.c
@@ -114,7 +114,7 @@ struct arc_arch_features_hasher
   target_desc *tdesc = arc_create_target_description (features);

   /* Add the newly created target description to the repertoire.  */
-  arc_tdesc_cache.emplace (features, tdesc);
+  arc_tdesc_cache.emplace (features, target_desc_up (tdesc));

   return tdesc;
 }
-------->8---------
Comment 1 Tom de Vries 2021-02-09 08:46:15 UTC
Setting target milestone to 10.2, as requested by arc maintainer.
Comment 2 Sourceware Commits 2021-02-09 17:38:39 UTC
The gdb-10-branch branch has been updated by Shahab Vahedi <shahab@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=15e1376fea4801f9bb9d5cacb0e6abc35693baa6

commit 15e1376fea4801f9bb9d5cacb0e6abc35693baa6
Author: Shahab Vahedi <shahab@synopsys.com>
Date:   Tue Feb 9 09:42:50 2021 +0100

    arc: Fix gcc-4.8 compilation failure for arc.c
    
    Building an arc target:
    
    $ configulre --target=arc-elf32                \
                 --enable-targets=arc-linux-uclibc \
                 ...
    
    On a system with gcc-4.8 (CentOS 7.x), fails with:
    --------8<---------
    ../../gdb/arch/arc.c:117:43:   required from here
    /usr/include/c++/4.8.2/bits/hashtable_policy.h:195:39: error: no matching
    function for call to 'std::pair<const arc_arch_features, const
    std::unique_ptr<target_desc, target_desc_deleter> >::pair(const
    arc_arch_features&, target_desc*&)'
      : _M_v(std::forward<_Args>(__args)...) { }
                                           ^
    /usr/include/c++/4.8.2/bits/hashtable_policy.h:195:39: note: candidates are:
    In file included from /usr/include/c++/4.8.2/utility:70:0,
                     from /usr/include/c++/4.8.2/tuple:38,
                     from /usr/include/c++/4.8.2/functional:55,
                     from ../../gdb/../gdbsupport/ptid.h:35,
                     from ../../gdb/../gdbsupport/common-defs.h:123,
                     from ../../gdb/arch/arc.c:19:
    /usr/include/c++/4.8.2/bits/stl_pair.h:206:9: note: template<class ...
    _Args1, long unsigned int ..._Indexes1, class ... _Args2, long unsigned int
    ..._Indexes2> std::pair<_T1, _T2>::pair(std::tuple<_Args1 ...>&,
    std::tuple<_Args2 ...>&, std::_Index_tuple<_Indexes1 ...>,
    std::_Index_tuple<_Indexes2 ...>)
             pair(tuple<_Args1...>&, tuple<_Args2...>&,
             ^
    -------->8---------
    
    The corresponding line in arc.c must use an explicit ctor:
    --------8<---------
     arc_lookup_target_description (...)
     {
    
       /* Add the newly created target description to the repertoire.  */
    -  arc_tdesc_cache.emplace (features, tdesc);
    +  arc_tdesc_cache.emplace (features, target_desc_up (tdesc));
    
       return tdesc;
     }
    -------->8---------
    See "PR gcc/96537" for more details.
    
    Last but not least, this problem has originally been investigated
    by Tom de Vries for RISCV targets (see 38f8aa06d9).
    
    gdb/ChangeLog:
    
            PR build/27385
            * arch/arc.c (arc_lookup_target_description): Use
            target_desc_up() ctor explicitly.
Comment 3 Shahab 2021-02-09 22:10:39 UTC
The commit mentioned in previous comment resolves this issue.
Comment 4 Ahmed Sayeed 2021-06-27 17:58:44 UTC Comment hidden (spam)
Comment 5 Ucel Sani 2021-08-19 06:02:37 UTC Comment hidden (spam)
Comment 6 ribevi 2021-08-27 18:00:37 UTC Comment hidden (spam)
Comment 7 james robin 2021-09-06 09:09:53 UTC Comment hidden (spam)
Comment 8 Mehmet gelisin 2021-09-10 19:40:12 UTC Comment hidden (spam)
Comment 9 Jamali 2021-09-14 01:33:59 UTC Comment hidden (spam)
Comment 10 johnb6174 2021-09-14 17:29:57 UTC Comment hidden (spam)
Comment 12 Kylan 2021-09-26 13:31:38 UTC Comment hidden (spam)
Comment 13 Craig Anderson 2021-10-05 16:00:32 UTC Comment hidden (spam)
Comment 15 johwelvic.bacolod 2021-10-08 04:09:27 UTC Comment hidden (spam)
Comment 16 Gulsen Engin 2021-10-09 11:01:02 UTC Comment hidden (spam)
Comment 17 oficaj3 2021-10-10 16:11:17 UTC Comment hidden (spam)
Comment 18 Canerkin 2021-10-18 19:57:57 UTC Comment hidden (spam)
Comment 19 progonsaytu 2021-10-19 07:14:00 UTC Comment hidden (spam)
Comment 20 fiteva 2021-10-23 13:46:43 UTC Comment hidden (spam)
Comment 21 glassmtech 2021-10-24 10:01:57 UTC Comment hidden (spam)
Comment 22 gepaw 2021-11-02 15:22:08 UTC Comment hidden (spam)
Comment 23 paneki 2021-11-06 21:12:30 UTC Comment hidden (spam)
Comment 24 tesaso8237@funboxcn.comxecana8007@funboxcn.com 2021-11-16 19:04:57 UTC Comment hidden (spam)
Comment 25 tesaso8237@funboxcn.comxecana8007@funboxcn.com 2021-11-16 19:08:45 UTC Comment hidden (spam)
Comment 26 tesaso8237@funboxcn.comxecana8007@funboxcn.com 2021-11-16 19:12:50 UTC Comment hidden (spam)
Comment 27 tesaso8237@funboxcn.comxecana8007@funboxcn.com 2021-11-16 19:16:03 UTC Comment hidden (spam)
Comment 28 gexed96894 2021-11-22 07:38:56 UTC Comment hidden (spam)
Comment 29 Bong Bong 2021-11-23 04:46:11 UTC Comment hidden (spam)
Comment 30 LeoRVM 2021-11-23 07:08:52 UTC Comment hidden (spam)
Comment 31 Scorpia 2021-11-23 09:00:23 UTC Comment hidden (spam)