Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@ericsson.com>
To: Ulrich Weigand <uweigand@de.ibm.com>
Cc: Yao Qi <qiyaoltc@gmail.com>, <gdb-patches@sourceware.org>
Subject: Re: [PATCH 3/2] Add some more casts (2/2)
Date: Mon, 28 Sep 2015 17:14:00 -0000	[thread overview]
Message-ID: <5609756F.9030903@ericsson.com> (raw)
In-Reply-To: <20150928154518.474FC2210@oc7340732750.ibm.com>

On 15-09-28 11:45 AM, Ulrich Weigand wrote:
> Simon Marchi wrote:
> 
>> @@ -1350,7 +1352,7 @@ ppu2spu_sniffer (const struct frame_unwind *self,
>>        info.bfd_arch_info = bfd_lookup_arch (bfd_arch_spu, bfd_mach_spu);
>>        info.byte_order = BFD_ENDIAN_BIG;
>>        info.osabi = GDB_OSABI_LINUX;
>> -      info.tdep_info = (void *) &data.id;
>> +      info.tdep_info = (struct gdbarch_tdep_info *) &data.id;
>>        data.gdbarch = gdbarch_find_by_info (info);
>>        if (!data.gdbarch)
>>  	return 0;
> 
> This causes compilation to fail (with the RHEL5 system compiler):
> 
> gdb/ppc-linux-tdep.c: In function 'ppu2spu_sniffer':
> gdb/ppc-linux-tdep.c:1355: warning: type-punning to incomplete type might break strict-aliasing rules
> 
> The problem seems to be that "struct gdbarch_tdep_info" actually
> does not exist and is not defined anywhere.  The info.tdep_info
> field is used as a generic pointer; different architectures use
> it for diffferent purposes.
> 
> Maybe in this case the correct fix would be to leave the (void *)
> casts in place and actually change the type of the field to void * ...
> 
> Bye,
> Ulrich

Thanks for pointing this out.  I was able to reproduce it using a Centos 5
docker container.

Changing the field and the cast to void* is ok to me.  I don't see any real
value in casting to a pointer to a type that doesn't exist.  Any other
opinions?


  reply	other threads:[~2015-09-28 17:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-23 19:31 [PATCH 2/2] Add some more casts (1/2) Simon Marchi
2015-09-23 19:31 ` [PATCH 3/2] Add some more casts (2/2) Simon Marchi
2015-09-25 13:20   ` Yao Qi
2015-09-25 18:19     ` Simon Marchi
2015-09-28 15:45       ` Ulrich Weigand
2015-09-28 17:14         ` Simon Marchi [this message]
2015-09-30 14:53           ` Simon Marchi
2015-09-30 15:16             ` Ulrich Weigand
2015-09-30 15:25               ` Simon Marchi
2015-09-25 13:17 ` [PATCH 2/2] Add some more casts (1/2) Yao Qi
2015-09-25 13:29   ` Simon Marchi
2015-09-25 18:18   ` Simon Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5609756F.9030903@ericsson.com \
    --to=simon.marchi@ericsson.com \
    --cc=gdb-patches@sourceware.org \
    --cc=qiyaoltc@gmail.com \
    --cc=uweigand@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox