Fix compilation failure in gdb.arch/aarch64-tagged-pointer.c
Commit Message
It seems like since commit
f17d9474776e ("Clear non-significant bits of address in watchpoint")
the test gdb.arch/aarch64-tagged-pointer.exp does not run because of:
/home/simark/src/binutils-gdb/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.c:49:12: error: redefinition of 'i'
for (int i = 0; i < 2; i++)
^
/home/simark/src/binutils-gdb/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.c:35:7: note: previous definition of 'i' was here
int i = 1234;
^
/home/simark/src/binutils-gdb/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.c:49:3: error: 'for' loop initial declarations are only allowed in C99 mode
for (int i = 0; i < 2; i++)
^
/home/simark/src/binutils-gdb/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.c:49:3: note: use option -std=c99 or -std=gnu99 to compile your code
This patch tries to fix it by using a different variable (j) for the
loop. With this patch, the test passes on the gcc116 machine of the
build farm.
gdb/testsuite/ChangeLog:
* gdb.arch/aarch64-tagged-pointer.c (main): Use a different variable in
for loop.
---
gdb/testsuite/gdb.arch/aarch64-tagged-pointer.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
@@ -33,6 +33,7 @@ main (void)
struct s s1;
struct s *sp1, *sp2;
int i = 1234;
+ int j;
int *p1, *p2;
s1.i = 1234;
@@ -46,7 +47,7 @@ main (void)
func_ptr = (void (*) (void)) ((uintptr_t) func_ptr | 0xf000000000000000ULL);
sp2->i = 4321; /* breakpoint here. */
- for (int i = 0; i < 2; i++)
+ for (j = 0; j < 2; j++)
{
foo ();
(*func_ptr) ();