This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 10/26] -Wpointer-sign: xtensa-tdep.c.
- From: Pedro Alves <palves at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 12 Apr 2013 00:00:08 +0100
- Subject: [PATCH 10/26] -Wpointer-sign: xtensa-tdep.c.
- References: <20130411225847 dot 16791 dot 29283 dot stgit at brno dot lan>
../../src/gdb/xtensa-tdep.c:2914:4: error: pointer targets in passing argument 7 of âxtensa_operand_get_fieldâ differ in signedness [-Werror=pointer-sign]
In file included from ../../src/gdb/xtensa-tdep.c:53:0:
../../src/gdb/../include/xtensa-isa.h:487:1: note: expected âunsigned int *â but argument is of type âint *â
../../src/gdb/xtensa-tdep.c:2916:4: error: pointer targets in passing argument 4 of âxtensa_operand_decodeâ differ in signedness [-Werror=pointer-sign]
In file included from ../../src/gdb/xtensa-tdep.c:53:0:
../../src/gdb/../include/xtensa-isa.h:507:1: note: expected âunsigned int *â but argument is of type âint *â
../../src/gdb/xtensa-tdep.c:2918:4: error: pointer targets in passing argument 7 of âxtensa_operand_get_fieldâ differ in signedness [-Werror=pointer-sign]
In file included from ../../src/gdb/xtensa-tdep.c:53:0:
../../src/gdb/../include/xtensa-isa.h:487:1: note: expected âunsigned int *â but argument is of type âint *â
../../src/gdb/xtensa-tdep.c:2920:4: error: pointer targets in passing argument 4 of âxtensa_operand_decodeâ differ in signedness [-Werror=pointer-sign]
In file included from ../../src/gdb/xtensa-tdep.c:53:0:
../../src/gdb/../include/xtensa-isa.h:507:1: note: expected âunsigned int *â but argument is of type âint *â
../../src/gdb/xtensa-tdep.c:2922:4: error: pointer targets in passing argument 7 of âxtensa_operand_get_fieldâ differ in signedness [-Werror=pointer-sign]
In file included from ../../src/gdb/xtensa-tdep.c:53:0:
../../src/gdb/../include/xtensa-isa.h:487:1: note: expected âunsigned int *â but argument is of type âint *â
../../src/gdb/xtensa-tdep.c:2924:4: error: pointer targets in passing argument 4 of âxtensa_operand_decodeâ differ in signedness [-Werror=pointer-sign]
In file included from ../../src/gdb/xtensa-tdep.c:53:0:
../../src/gdb/../include/xtensa-isa.h:507:1: note: expected âunsigned int *â but argument is of type âint *â
Those bfd functions that decode instructions output uint32_t values.
Hence this fix:
2013-04-11 Pedro Alves <palves@redhat.com>
* xtensa-tdep.c (execute_l32e, execute_s32e): Change type of
parameters 'at', 'as' and 'offset' to uint32_t.
'func' is either execute_l32e or execute_s32e. AFAICT from the xtensa
assembly I found, l32e/s32e work with a a signed offset. This
preserves that, as the 'offset' variable is still implicitly cast to
signed int in the 'func' call.
---
gdb/xtensa-tdep.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index 1eedee7..d9b1a45 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -2814,7 +2814,7 @@ execute_code (struct gdbarch *gdbarch, CORE_ADDR current_pc, CORE_ADDR wb)
int fail = 0;
void (*func) (struct gdbarch *, int, int, int, CORE_ADDR);
- int at, as, offset;
+ uint32_t at, as, offset;
/* WindowUnderflow12 = true, when inside _WindowUnderflow12. */
int WindowUnderflow12 = (current_pc & 0x1ff) >= 0x140;