This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
PATCH: Work around gcc 3.4 alias warning bug
- From: "H. J. Lu" <hjl at lucon dot org>
- To: GDB <gdb-patches at sources dot redhat dot com>
- Date: Wed, 20 Jun 2007 10:02:49 -0700
- Subject: PATCH: Work around gcc 3.4 alias warning bug
With gcc 3.4, I got
gcc -c -g -O2 -I. -I/net/gnu-2/export/gnu/src/gdb/gdb/gdb
-I/net/gnu-2/export/gnu/src/gdb/gdb/gdb/config
-DLOCALEDIR="\"/usr/local/share/locale\"" -DHAVE_CONFIG_H
-I/net/gnu-2/export/gnu/src/gdb/gdb/gdb/../include/opcode
-I/net/gnu-2/export/gnu/src/gdb/gdb/gdb/../readline/.. -I../bfd
-I/net/gnu-2/export/gnu/src/gdb/gdb/gdb/../bfd
-I/net/gnu-2/export/gnu/src/gdb/gdb/gdb/../include -DMI_OUT=1 -DTUI=1
-Wall -Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral
-Wno-unused -Wno-switch -Wno-char-subscripts -Werror
/net/gnu-2/export/gnu/src/gdb/gdb/gdb/cli/cli-dump.c/net/gnu-2/export/gnu/src/gdb/gdb/gdb/core-regset.c:
In function
`fetch_core_registers':/net/gnu-2/export/gnu/src/gdb/gdb/gdb/core-regset.c:78:
warning: dereferencing type-punned pointer will break strict-aliasing
rules/net/gnu-2/export/gnu/src/gdb/gdb/gdb/core-regset.c:89: warning:
dereferencing type-punned pointer will break strict-aliasing
rulesmake[4]: *** [core-regset.o] Error 1
on Linux/ia64. This patch works around it.
H.J.
-----
2007-06-19 H.J. Lu <hongjiu.lu@intel.com>
* core-regset.c (fetch_core_registers): Work around gcc 3.4
alias warning bug.
--- gdb/core-regset.c.type 2007-06-19 08:44:03.000000000 -0700
+++ gdb/core-regset.c 2007-06-19 17:05:31.000000000 -0700
@@ -66,6 +66,8 @@ fetch_core_registers (struct regcache *r
{
gdb_gregset_t gregset;
gdb_fpregset_t fpregset;
+ gdb_gregset_t *gregset_p = &gregset;
+ gdb_fpregset_t *fpregset_p = &fpregset;
switch (which)
{
@@ -75,7 +77,7 @@ fetch_core_registers (struct regcache *r
else
{
memcpy (&gregset, core_reg_sect, sizeof (gregset));
- supply_gregset (regcache, (const gdb_gregset_t *) &gregset);
+ supply_gregset (regcache, (const gdb_gregset_t *) gregset_p);
}
break;
@@ -86,7 +88,7 @@ fetch_core_registers (struct regcache *r
{
memcpy (&fpregset, core_reg_sect, sizeof (fpregset));
if (gdbarch_fp0_regnum (current_gdbarch) >= 0)
- supply_fpregset (regcache, (const gdb_fpregset_t *) &fpregset);
+ supply_fpregset (regcache, (const gdb_fpregset_t *) fpregset_p);
}
break;