This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


On 12/01/2015 03:12 PM, Ulrich Weigand wrote:
> 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.

I agree.

> 
> 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);

Indeed, that should work.

Thanks,
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]