public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/32503] New: gdb: 'construct' has not been declared in 'std::allocator<unsigned char>
@ 2024-12-27 3:52 jeffrey.cliff at gmail dot com
2024-12-27 11:35 ` [Bug gdb/32503] " ssbssa at sourceware dot org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: jeffrey.cliff at gmail dot com @ 2024-12-27 3:52 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=32503
Bug ID: 32503
Summary: gdb: 'construct' has not been declared in
'std::allocator<unsigned char>
Product: gdb
Version: unknown
Status: UNCONFIRMED
Severity: minor
Priority: P2
Component: gdb
Assignee: unassigned at sourceware dot org
Reporter: jeffrey.cliff at gmail dot com
Target Milestone: ---
( looks very much like #29715
https://sourceware.org/bugzilla/show_bug.cgi?id=29715 )
OS : pureos byzantium
arch : aarch64
gcc : (Debian 10.2.1-6) 10.2.1 20210110
gdb : weekly 16.0.50.20241226
CXXFLAGS=-std=gnu++20 -Os -march=native
CFLAGS=-std=gnu17 -Os -march=native
true "AR_FLAGS=rc" "CC_FOR_BUILD=gcc" "CFLAGS=-std=gnu17 -Os -march=native "
"CXXFLAGS=-std=gnu++20 -Os -march=native " "CFLAGS_FOR_BUILD=-std=gnu17 -Os
-march=native" "CFLAGS_FOR_TARGET=-g -O2 -std=gnu17 -Os -march=native"
"INSTALL=/usr/bin/install -c" "INSTALL_DATA=/usr/bin/install -c -m 644"
"INSTALL_PROGRAM=/usr/bin/install -c" "INSTALL_SCRIPT=/usr/bin/install -c"
"LDFLAGS=-s " "LIBCFLAGS=-std=gnu17 -Os -march=native "
"LIBCFLAGS_FOR_TARGET=-g -O2 -std=gnu17 -Os -march=native" "MAKE=make"
"MAKEINFO=makeinfo --split-size=5000000 --split-size=5000000 " "PICFLAG="
"PICFLAG_FOR_TARGET=" "SHELL=/bin/bash" "EXPECT=expect" "RUNTEST=runtest"
"RUNTESTFLAGS=" "exec_prefix=/usr/local" "infodir=/usr/local/share/info"
"libdir=/usr/local/lib" "prefix=/usr/local"
"tooldir=/usr/local/aarch64-unknown-linux-gnu" "AR=ar --plugin
/usr/lib/gcc/aarch64-linux-gnu/10/liblto_plugin.so" "AS=as" "CC=gcc" "CXX=g++"
"LD=ld" "LIBCFLAGS=-std=gnu17 -Os -march=native " "NM=nm" "PICFLAG="
"RANLIB=ranlib --plugin /usr/lib/gcc/aarch64-linux-gnu/10/liblto_plugin.so"
"DESTDIR=" DO=all multi-do
when making :
make[4]: Entering directory '/home/purism/gdb-16.0.50.20241226/gdbsupport'
CXX common-utils.o
In file included from ../gdbsupport/def-vector.h:22,
from ../gdbsupport/byte-vector.h:21,
from ././common-utils.h:25,
from ././common-defs.h:206,
from <command-line>:
../gdbsupport/default-init-alloc.h: In instantiation of ‘class
gdb::default_init_allocator<unsigned char, std::allocator<unsigned char> >’:
/usr/include/c++/10/bits/stl_vector.h:87:21: required from ‘struct
std::_Vector_base<unsigned char, gdb::default_init_allocator<unsigned char,
std::allocator<unsigned char> > >’
/usr/include/c++/10/bits/stl_vector.h:389:11: required from ‘class
std::vector<unsigned char, gdb::default_init_allocator<unsigned char,
std::allocator<unsigned char> > >’
common-utils.cc:459:25: required from here
../gdbsupport/default-init-alloc.h:63:12: error: ‘construct’ has not been
declared in ‘std::allocator<unsigned char>’
63 | using A::construct;
| ^~~~~~~~~
this does *not* occur when $CFLAGS / $CXXFLAGS are empty.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug gdb/32503] gdb: 'construct' has not been declared in 'std::allocator<unsigned char>
2024-12-27 3:52 [Bug gdb/32503] New: gdb: 'construct' has not been declared in 'std::allocator<unsigned char> jeffrey.cliff at gmail dot com
@ 2024-12-27 11:35 ` ssbssa at sourceware dot org
2025-01-06 16:34 ` tromey at sourceware dot org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: ssbssa at sourceware dot org @ 2024-12-27 11:35 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=32503
Hannes Domani <ssbssa at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
CC| |ssbssa at sourceware dot org
Last reconfirmed| |2024-12-27
--- Comment #1 from Hannes Domani <ssbssa at sourceware dot org> ---
The fix [1] of PR29715 checks if __cplusplus is at least 202002L to detect
c++20, but in gcc-10 the value used for c++20 is actually 201709L (it's 201703L
for c++17).
[1]
https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=6feae66da1d652a50c1759bae46128087f7dfab0
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug gdb/32503] gdb: 'construct' has not been declared in 'std::allocator<unsigned char>
2024-12-27 3:52 [Bug gdb/32503] New: gdb: 'construct' has not been declared in 'std::allocator<unsigned char> jeffrey.cliff at gmail dot com
2024-12-27 11:35 ` [Bug gdb/32503] " ssbssa at sourceware dot org
@ 2025-01-06 16:34 ` tromey at sourceware dot org
2025-01-07 7:45 ` [Bug build/32503] " vries at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: tromey at sourceware dot org @ 2025-01-06 16:34 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=32503
Tom Tromey <tromey at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tromey at sourceware dot org
--- Comment #2 from Tom Tromey <tromey at sourceware dot org> ---
I wonder if this code could check __cpp_lib_polymorphic_allocator instead.
Maybe that would be more robust. See
https://en.cppreference.com/w/cpp/feature_test#cpp_lib_polymorphic_allocator
I'm not sure if we want to change the code to check 201709L.
I guess it would be ok if it's harmless for other situations,
at least with a suitable comment.
Anyway a workaround is not to build in C++20 mode.
gdb is officially using C++17 (though in practice it
uses some C++20 things if they are available).
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug build/32503] gdb: 'construct' has not been declared in 'std::allocator<unsigned char>
2024-12-27 3:52 [Bug gdb/32503] New: gdb: 'construct' has not been declared in 'std::allocator<unsigned char> jeffrey.cliff at gmail dot com
2024-12-27 11:35 ` [Bug gdb/32503] " ssbssa at sourceware dot org
2025-01-06 16:34 ` tromey at sourceware dot org
@ 2025-01-07 7:45 ` vries at gcc dot gnu.org
2025-01-07 8:55 ` vries at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2025-01-07 7:45 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=32503
Tom de Vries <vries at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|gdb |build
CC| |vries at gcc dot gnu.org
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug build/32503] gdb: 'construct' has not been declared in 'std::allocator<unsigned char>
2024-12-27 3:52 [Bug gdb/32503] New: gdb: 'construct' has not been declared in 'std::allocator<unsigned char> jeffrey.cliff at gmail dot com
` (2 preceding siblings ...)
2025-01-07 7:45 ` [Bug build/32503] " vries at gcc dot gnu.org
@ 2025-01-07 8:55 ` vries at gcc dot gnu.org
2025-01-10 7:40 ` cvs-commit at gcc dot gnu.org
2025-01-10 7:41 ` vries at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2025-01-07 8:55 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=32503
--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
https://sourceware.org/pipermail/gdb-patches/2025-January/214512.html
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug build/32503] gdb: 'construct' has not been declared in 'std::allocator<unsigned char>
2024-12-27 3:52 [Bug gdb/32503] New: gdb: 'construct' has not been declared in 'std::allocator<unsigned char> jeffrey.cliff at gmail dot com
` (3 preceding siblings ...)
2025-01-07 8:55 ` vries at gcc dot gnu.org
@ 2025-01-10 7:40 ` cvs-commit at gcc dot gnu.org
2025-01-10 7:41 ` vries at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2025-01-10 7:40 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=32503
--- Comment #4 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <vries@sourceware.org>:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6f04937e1d7db190ca96ec08d8aeb25f0ec6e994
commit 6f04937e1d7db190ca96ec08d8aeb25f0ec6e994
Author: Tom de Vries <tdevries@suse.de>
Date: Fri Jan 10 08:40:11 2025 +0100
[gdb/build, c++20] Fix build with gcc 10
With gcc 10 and -std=c++20, we run into the same problem as reported in
commit
6feae66da1d ("[gdb/build, c++20] Handle deprecated
std::allocator::construct").
The problem was fixed using:
...
-template<typename T, typename A = std::allocator<T>>
+template<typename T,
+ typename A
+#if __cplusplus >= 202002L
+ = std::pmr::polymorphic_allocator<T>
+#else
+ = std::allocator<T>
+#endif
+ >
...
but that doesn't work for gcc 10, because it defines __cplusplus
differently:
...
$ echo | g++-10 -E -dD -x c++ - -std=c++20 2>&1 | grep __cplusplus
#define __cplusplus 201709L
$ echo | g++-11 -E -dD -x c++ - -std=c++20 2>&1 | grep __cplusplus
#define __cplusplus 202002L
...
Fix this by using the library feature test macro
__cpp_lib_polymorphic_allocator [1], which is undefined for c++17 and
defined
for c++20:
...
$ echo | g++-10 -E -dD -x c++ - -include memory_resource -std=c++17 2>&1 \
| grep __cpp_lib_polymorphic_allocator
$ echo | g++-10 -E -dD -x c++ - -include memory_resource -std=c++20 2>&1 \
| grep __cpp_lib_polymorphic_allocator
#define __cpp_lib_polymorphic_allocator 201902L
$
...
A similar problem exists for commit 3173529d7de ("[gdb/guile, c++20] Work
around Werror=volatile in libguile.h"). Fix this by testing for 201709L
instead.
Tested on x86_64-linux, by building gdb with
{gcc 10, clang 17.0.6} x {-std=c++17, -std=c++20}.
PR build/32503
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32503
Approved-By: Tom Tromey <tom@tromey.com>
[1]
https://en.cppreference.com/w/cpp/feature_test#cpp_lib_polymorphic_allocator
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug build/32503] gdb: 'construct' has not been declared in 'std::allocator<unsigned char>
2024-12-27 3:52 [Bug gdb/32503] New: gdb: 'construct' has not been declared in 'std::allocator<unsigned char> jeffrey.cliff at gmail dot com
` (4 preceding siblings ...)
2025-01-10 7:40 ` cvs-commit at gcc dot gnu.org
@ 2025-01-10 7:41 ` vries at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2025-01-10 7:41 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=32503
Tom de Vries <vries at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |17.1
--- Comment #5 from Tom de Vries <vries at gcc dot gnu.org> ---
Fixed.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-01-10 7:41 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-27 3:52 [Bug gdb/32503] New: gdb: 'construct' has not been declared in 'std::allocator<unsigned char> jeffrey.cliff at gmail dot com
2024-12-27 11:35 ` [Bug gdb/32503] " ssbssa at sourceware dot org
2025-01-06 16:34 ` tromey at sourceware dot org
2025-01-07 7:45 ` [Bug build/32503] " vries at gcc dot gnu.org
2025-01-07 8:55 ` vries at gcc dot gnu.org
2025-01-10 7:40 ` cvs-commit at gcc dot gnu.org
2025-01-10 7:41 ` vries at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).