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 3/2] Add some more casts (2/2)


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


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