[patch] gdbserver: variable might be clobbered by ‘longjmp’

Jan Kratochvil jan.kratochvil@redhat.com
Sat May 26 13:53:00 GMT 2012


Hi,

gcc -flto with gcc-4.7.0-5.fc17.x86_64 produces
server.c: In function ‘main’:
server.c:2607:7: error: variable ‘multi_mode’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered]
server.c:2608:7: error: variable ‘attach’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered]

probably obvious, I will check it in.


Thanks,
Jan


gdb/gdbserver/
2012-05-26  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Fix gcc -flto compilation warning.
	* server.c (main): Make variable multi_mode and attach volatile.

diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 30bb3c3..9fd550b 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -2604,8 +2604,8 @@ main (int argc, char *argv[])
   int pid;
   char *arg_end, *port;
   char **next_arg = &argv[1];
-  int multi_mode = 0;
-  int attach = 0;
+  volatile int multi_mode = 0;
+  volatile int attach = 0;
   int was_running;
 
   while (*next_arg != NULL && **next_arg == '-')



More information about the Gdb-patches mailing list