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-06-27 17:58 UTC (History)
2 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 cvs-commit@gcc.gnu.org 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)