This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Avoid gcc warning on sparc solaris 9
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: pedro_alves at portugalmail dot pt (Pedro Alves)
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 23 Oct 2007 19:10:30 +0200 (CEST)
- Subject: Re: Avoid gcc warning on sparc solaris 9
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