aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2024-05-16 12:35:53 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2024-05-16 13:25:49 -0400
commit89457440e4a4b71b1fe60ed3e034c814bf8eb6b7 (patch)
treed89663b14c85b39ce87739b3f65b2d9d012a2b01 /gdb
parente2e6bf023e856831fefb6c7f9b4aee9283c6dde7 (diff)
downloadgdb-89457440e4a4b71b1fe60ed3e034c814bf8eb6b7.zip
gdb-89457440e4a4b71b1fe60ed3e034c814bf8eb6b7.tar.gz
gdb-89457440e4a4b71b1fe60ed3e034c814bf8eb6b7.tar.bz2
gdb: initialize packet_result::m_textual_err_msg
When building GDB with -O2 and --enable-ubsan, I get some random errors in the packet_result self test: /home/smarchi/src/binutils-gdb/gdb/remote.c:161:7: runtime error: load of value 92, which is not a valid value for type 'bool' This happens because packet_result::m_textual_err_msg is uninitialized when using the second constructor. When such a packet_result object gets copied, an invalid value for m_textual_err_msg (a bool field) is loaded, which triggers ubsan. Avoid this by initializing m_textual_err_msg. Change-Id: I3ce44816bb0bfc6e442067292f993e5c17301b85 Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb')
-rw-r--r--gdb/remote.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/remote.c b/gdb/remote.c
index 6e568eb..42b446c 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -222,7 +222,7 @@ private:
/* True if we have a textual error message, from an "E.MESSAGE"
response. */
- bool m_textual_err_msg;
+ bool m_textual_err_msg = false;
};
/* Enumeration of packets for a remote target. */