This is the mail archive of the
gdb-testers@sourceware.org
mailing list for the GDB project.
[binutils-gdb] gdb: Fix std::{min, max}-related build breakage on 32-bit hosts
- From: sergiodj+buildbot at sergiodj dot net
- To: gdb-testers at sourceware dot org
- Date: Sun, 18 Sep 2016 19:24:30 -0400
- Subject: [binutils-gdb] gdb: Fix std::{min, max}-related build breakage on 32-bit hosts
- Authentication-results: sourceware.org; auth=none
*** TEST RESULTS FOR COMMIT 768adc05c44c7e8b5c0f9ca5ad3ca96657715293 ***
Author: Pedro Alves <palves@redhat.com>
Branch: master
Commit: 768adc05c44c7e8b5c0f9ca5ad3ca96657715293
gdb: Fix std::{min, max}-related build breakage on 32-bit hosts
Building on a 32-bit host fails currently with errors like:
.../src/gdb/exec.c: In function target_xfer_status section_table_read_available_memory(gdb_byte*, ULONGEST, ULONGEST, ULONGEST*):
.../src/gdb/exec.c:801:54: error: no matching function for call to min(ULONGEST, long unsigned int)
end = std::min (offset + len, r->start + r->length);
^
In file included from /usr/include/c++/5.3.1/algorithm:61:0,
from .../src/gdb/exec.c:46:
/usr/include/c++/5.3.1/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&)
min(const _Tp& __a, const _Tp& __b)
^
/usr/include/c++/5.3.1/bits/stl_algobase.h:195:5: note: template argument deduction/substitution failed:
.../src/gdb/exec.c:801:54: note: deduced conflicting types for parameter const _Tp (long long unsigned int and long unsigned int)
end = std::min (offset + len, r->start + r->length);
^
In file included from /usr/include/c++/5.3.1/algorithm:61:0,
from .../src/gdb/exec.c:46:
/usr/include/c++/5.3.1/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
min(const _Tp& __a, const _Tp& __b, _Compare __comp)
^
The problem is that the std::min/std::max function templates use the
same type for both parameters. When the argument types are different,
the compiler can't automatically deduce which template specialization
to pick from the arguments' types.
Fix that by specifying the specialization we want explicitly.
gdb/ChangeLog:
2016-09-18 Pedro Alves <palves@redhat.com>
* breakpoint.c (hardware_watchpoint_inserted_in_range): Explicitly
specify the std:min/std::max specialization.
* exec.c (section_table_read_available_memory): Likewise.
* remote.c (remote_read_qxfer): Likewise.
* target.c (simple_verify_memory): Likewise.
- Follow-Ups:
- *** COMPILATION FAILED *** Failures on Debian-s390x-native-gdbserver-m64, branch master *** BREAKAGE ***
- *** COMPILATION FAILED *** Failures on Debian-s390x-m64, branch master *** BREAKAGE ***
- *** COMPILATION FAILED *** Failures on Fedora-s390x-m64, branch master *** BREAKAGE ***
- *** COMPILATION FAILED *** Failures on Debian-s390x-native-extended-gdbserver-m64, branch master *** BREAKAGE ***
- Failures on Ubuntu-AArch64-m64, branch master
- Failures on Fedora-x86_64-native-extended-gdbserver-m64, branch master
- Failures on Fedora-x86_64-native-gdbserver-m64, branch master
- Failures on Debian-i686, branch master
- Failures on Fedora-i686, branch master
- Failures on Ubuntu-AArch64-native-gdbserver-m64, branch master
- Failures on Debian-x86_64-native-extended-gdbserver-m64, branch master
- Failures on Fedora-ppc64be-native-gdbserver-m64, branch master
- Failures on Fedora-ppc64be-native-extended-gdbserver-m64, branch master
- Failures on Fedora-ppc64le-m64, branch master
- Failures on Fedora-ppc64le-native-extended-gdbserver-m64, branch master
- Failures on Fedora-ppc64le-native-gdbserver-m64, branch master