This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 3/2] Add some more casts (2/2)
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: simon dot marchi at ericsson dot com (Simon Marchi)
- Cc: qiyaoltc at gmail dot com (Yao Qi), gdb-patches at sourceware dot org
- Date: Mon, 28 Sep 2015 17:45:18 +0200 (CEST)
- Subject: Re: [PATCH 3/2] Add some more casts (2/2)
- Authentication-results: sourceware.org; auth=none
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
--
Dr. Ulrich Weigand
GNU/Linux compilers and toolchain
Ulrich.Weigand@de.ibm.com