Re: Avoid gcc warning on sparc solaris 9

Ulrich Weigand
2007-10-23T17:10:41Z

Pedro Alves wrote:

> Building HEAD on a native gdb on sparc solaris 9 with gcc 3.4.6 stops due to:
>
> ../../src/gdb/sol-thread.c: In function `sol_thread_fetch_registers':
> ../../src/gdb/sol-thread.c:533: warning: dereferencing type-punned
> pointer will break strict-aliasing rules

We've seen this on other platforms with gcc 3.4 as well. I think
the best fix would be replace the problematic construct
supply_gregset (regcache, (const gdb_gregset_t *) &gregset);
with

gdb_gregset_t *gregset_p = &gregset;

supply_gregset (regcache, (const gdb_gregset_t *) gregset_p);

That seemed to fix the problems e.g. in i386-linux-nat.c (fetch_regs).

Bye,
Ulrich

--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com