Discussion:
[Bug build/21773] New: binutils-gdb/gdb/common/vec.h:1085:31: error: ‘void* memcpy(void*, const void*, size_t)’ copying an object of non-trivial type ‘btrace_insn_s {aka struct btrace_insn}’ from an array of ‘btrace_insn_s [1] {aka struct btrace_insn [1]}’ [-Werror=class-m
dilyan.palauzov at aegee dot org
2017-07-15 10:08:17 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=21773

Bug ID: 21773
Summary: binutils-gdb/gdb/common/vec.h:1085:31: error: ‘void*
memcpy(void*, const void*, size_t)’ copying an object
of non-trivial type ‘btrace_insn_s {aka struct
btrace_insn}’ from an array of ‘btrace_insn_s [1] {aka
struct btrace_insn [1]}’ [-Werror=class-m
Product: gdb
Version: HEAD
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: build
Assignee: unassigned at sourceware dot org
Reporter: dilyan.palauzov at aegee dot org
Target Milestone: ---

Most current gdb does not compile with most current gcc:

make[6]: Leaving directory '/home/d/binutils/gdb/build-gnulib/import'
make[5]: Leaving directory '/home/d/binutils/gdb/build-gnulib'
make[4]: Leaving directory '/home/d/binutils/gdb/build-gnulib'
make[3]: Leaving directory '/home/d/binutils/gdb'
g++ -x c++ -g -O2 -I. -I/git/binutils-gdb/gdb -I/git/binutils-gdb/gdb/common
-I/git/binutils-gdb/gdb/config -DLOCALEDIR="\"/usr/local/share/locale\""
-DHAVE_CONFIG_H -I/git/binutils-gdb/gdb/../include/opcode
-I/git/binutils-gdb/gdb/../opcodes/.. -I../bfd -I/git/binutils-gdb/gdb/../bfd
-I/git/binutils-gdb/gdb/../include -I../libdecnumber
-I/git/binutils-gdb/gdb/../libdecnumber -I/git/binutils-gdb/gdb/gnulib/import
-Ibuild-gnulib/import -I/usr/local/include/python3.5m
-I/usr/local/include/python3.5m -Wall -Wpointer-arith -Wno-unused
-Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body
-Wunused-but-set-parameter -Wunused-but-set-variable -Wno-sign-compare
-Wno-narrowing -Wno-error=maybe-uninitialized -Werror -c -o arc-tdep.o -MT
arc-tdep.o -MMD -MP -MF .deps/arc-tdep.Tpo /git/binutils-gdb/gdb/arc-tdep.c
In file included from /git/binutils-gdb/gdb/common/gdb_vecs.h:23:0,
from /git/binutils-gdb/gdb/symtab.h:24,
from /git/binutils-gdb/gdb/language.h:26,
from /git/binutils-gdb/gdb/frame.h:72,
from /git/binutils-gdb/gdb/gdbarch.h:39,
from /git/binutils-gdb/gdb/defs.h:636,
from /git/binutils-gdb/gdb/arc-tdep.c:22:
/git/binutils-gdb/gdb/btrace.h: In function ‘VEC_btrace_insn_s*
VEC_btrace_insn_s_copy(VEC_btrace_insn_s*)’:
/git/binutils-gdb/gdb/common/vec.h:1065:58: error: ‘void* memcpy(void*, const
void*, size_t)’ copying an object of non-trivial type ‘btrace_insn_s {aka
struct btrace_insn}’ from an array of ‘btrace_insn_s [1] {aka struct
btrace_insn [1]}’ [-Werror=class-memaccess]
memcpy (new_vec_->vec, vec_->vec, sizeof (T) * len_); \
^
/git/binutils-gdb/gdb/common/vec.h:461:1: note: in expansion of macro
‘DEF_VEC_ALLOC_FUNC_O’
DEF_VEC_ALLOC_FUNC_O(T) \
^~~~~~~~~~~~~~~~~~~~
/git/binutils-gdb/gdb/btrace.h:86:1: note: in expansion of macro ‘DEF_VEC_O’
DEF_VEC_O (btrace_insn_s);
^~~~~~~~~
In file included from /git/binutils-gdb/gdb/target.h:74:0,
from /git/binutils-gdb/gdb/exec.h:23,
from /git/binutils-gdb/gdb/gdbcore.h:29,
from /git/binutils-gdb/gdb/arc-tdep.c:28:
/git/binutils-gdb/gdb/btrace.h:69:8: note: ‘btrace_insn_s {aka struct
btrace_insn}’ declared here
struct btrace_insn
^~~~~~~~~~~
In file included from /git/binutils-gdb/gdb/common/gdb_vecs.h:23:0,
from /git/binutils-gdb/gdb/symtab.h:24,
from /git/binutils-gdb/gdb/language.h:26,
from /git/binutils-gdb/gdb/frame.h:72,
from /git/binutils-gdb/gdb/gdbarch.h:39,
from /git/binutils-gdb/gdb/defs.h:636,
from /git/binutils-gdb/gdb/arc-tdep.c:22:
/git/binutils-gdb/gdb/btrace.h: In function ‘VEC_btrace_insn_s*
VEC_btrace_insn_s_merge(VEC_btrace_insn_s*, VEC_btrace_insn_s*)’:
/git/binutils-gdb/gdb/common/vec.h:1083:65: error: ‘void* memcpy(void*, const
void*, size_t)’ copying an object of non-trivial type ‘btrace_insn_s {aka
struct btrace_insn}’ from an array of ‘btrace_insn_s [1] {aka struct
btrace_insn [1]}’ [-Werror=class-memaccess]
memcpy (new_vec_->vec, vec1_->vec, sizeof (T) * vec1_->num); \
^
/git/binutils-gdb/gdb/common/vec.h:461:1: note: in expansion of macro
‘DEF_VEC_ALLOC_FUNC_O’
DEF_VEC_ALLOC_FUNC_O(T) \
^~~~~~~~~~~~~~~~~~~~
/git/binutils-gdb/gdb/btrace.h:86:1: note: in expansion of macro ‘DEF_VEC_O’
DEF_VEC_O (btrace_insn_s);
^~~~~~~~~
In file included from /git/binutils-gdb/gdb/target.h:74:0,
from /git/binutils-gdb/gdb/exec.h:23,
from /git/binutils-gdb/gdb/gdbcore.h:29,
from /git/binutils-gdb/gdb/arc-tdep.c:28:
/git/binutils-gdb/gdb/btrace.h:69:8: note: ‘btrace_insn_s {aka struct
btrace_insn}’ declared here
struct btrace_insn
^~~~~~~~~~~
In file included from /git/binutils-gdb/gdb/common/gdb_vecs.h:23:0,
from /git/binutils-gdb/gdb/symtab.h:24,
from /git/binutils-gdb/gdb/language.h:26,
from /git/binutils-gdb/gdb/frame.h:72,
from /git/binutils-gdb/gdb/gdbarch.h:39,
from /git/binutils-gdb/gdb/defs.h:636,
from /git/binutils-gdb/gdb/arc-tdep.c:22:
/git/binutils-gdb/gdb/common/vec.h:1085:31: error: ‘void* memcpy(void*, const
void*, size_t)’ copying an object of non-trivial type ‘btrace_insn_s {aka
struct btrace_insn}’ from an array of ‘btrace_insn_s [1] {aka struct
btrace_insn [1]}’ [-Werror=class-memaccess]
sizeof (T) * vec2_->num); \
^
/git/binutils-gdb/gdb/common/vec.h:461:1: note: in expansion of macro
‘DEF_VEC_ALLOC_FUNC_O’
DEF_VEC_ALLOC_FUNC_O(T) \
^~~~~~~~~~~~~~~~~~~~
/git/binutils-gdb/gdb/btrace.h:86:1: note: in expansion of macro ‘DEF_VEC_O’
DEF_VEC_O (btrace_insn_s);
^~~~~~~~~
In file included from /git/binutils-gdb/gdb/target.h:74:0,
from /git/binutils-gdb/gdb/exec.h:23,
from /git/binutils-gdb/gdb/gdbcore.h:29,
from /git/binutils-gdb/gdb/arc-tdep.c:28:
/git/binutils-gdb/gdb/btrace.h:69:8: note: ‘btrace_insn_s {aka struct
btrace_insn}’ declared here
struct btrace_insn
^~~~~~~~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [Makefile:1910: arc-tdep.o] Error 1
make[2]: Leaving directory '/home/d/binutils/gdb'
make[1]: *** [Makefile:10439: all-gdb] Error 2
make[1]: Leaving directory '/home/d/binutils'
make: *** [Makefile:850: all] Error 2
--
You are receiving this mail because:
You are on the CC list for the bug.
msebor at gmail dot com
2017-08-15 18:03:35 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=21773

Martin Sebor <msebor at gmail dot com> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |msebor at gmail dot com

--- Comment #1 from Martin Sebor <msebor at gmail dot com> ---
The errors were discussed on gcc-patches, along with a trivial patch for them:
https://gcc.gnu.org/ml/gcc-patches/2017-07/msg00299.html

The solution might need to be guarded if GDB is meant to compile with C++ 98
compiler. Like so:

index ddfcddf..f344c4b 100644
--- a/gdb/common/enum-flags.h
+++ b/gdb/common/enum-flags.h
@@ -116,9 +116,13 @@ private:

public:
/* Allow default construction. */
+#if __cplusplus >= 201103L
+ enum_flags () = default;
+#else
enum_flags ()
: m_enum_value ((enum_type) 0)
{}
+#endif

/* If you get an error saying these two overloads are ambiguous,
then you tried to mix values of different enum types. */
--
You are receiving this mail because:
You are on the CC list for the bug.
simon.marchi at ericsson dot com
2018-08-20 04:18:32 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=21773

Simon Marchi <simon.marchi at ericsson dot com> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |simon.marchi at ericsson dot com

--- Comment #2 from Simon Marchi <simon.marchi at ericsson dot com> ---
Is this still relevant? I think it builds fine now.
--
You are receiving this mail because:
You are on the CC list for the bug.
dilyan.palauzov at aegee dot org
2018-08-20 05:06:54 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=21773

--- Comment #3 from dilyan.palauzov at aegee dot org <dilyan.palauzov at aegee dot org> ---
I don't know if this is still relevant, I don't have that environment anymore.

Handling such things one year later is dysfunctional.
--
You are receiving this mail because:
You are on the CC list for the bug.
palves at redhat dot com
2018-08-20 06:10:30 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=21773

Pedro Alves <palves at redhat dot com> changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
CC| |palves at redhat dot com
Resolution|--- |FIXED

--- Comment #4 from Pedro Alves <palves at redhat dot com> ---
I recall that this was all fixed in a different way at the time. Closing it.
Post by dilyan.palauzov at aegee dot org
Handling such things one year later is dysfunctional.
Thank you for your contribution.
--
You are receiving this mail because:
You are on the CC list for the bug.
Loading...