Re: [PATCH 10/18] Remote thread create/exit events

Ulrich Weigand
2015-12-01T15:12:37Z

Pedro Alves wrote:

> + case 'w': /* Thread exited. */
> + {
> + char *p;
> + ULONGEST value;
> +
> + event->ws.kind = TARGET_WAITKIND_THREAD_EXITED;
> + p = unpack_varlen_hex (&buf[1], &value);
> + event->ws.value.integer = value;
> + if (*p != ';')
> + error (_("stop reply packet badly formatted: %s"), buf);
> + event->ptid = read_ptid (++p, &p);

This causes a build error on my RHEL 5 daily build system (using
the GCC 4.1.2 host compiler) due to:

gdb/remote.c: In function 'remote_parse_stop_reply':
gdb/remote.c:6549: warning: operation on 'p' may be undefined

I'm not 100% convinced this is really undefined, since the
value of &p doesn't change whether or not ++p is evaluated
before or after it.

But in any case, since p isn't used afterwards, any reason why
this couldn't instead just be:

event->ptid = read_ptid (++p, NULL);

Bye,
Ulrich

--
Dr. Ulrich Weigand
GNU/Linux compilers and toolchain
Ulrich.Weigand@de.ibm.com