public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix compilation failure in gdb.arch/aarch64-tagged-pointer.c
@ 2018-04-11  1:54 Simon Marchi
  0 siblings, 0 replies; only message in thread
From: Simon Marchi @ 2018-04-11  1:54 UTC (permalink / raw)
  To: gdb-patches; +Cc: omair.javaid, Simon Marchi

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(-)

diff --git a/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.c b/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.c
index c6fad0aae850..17b8a24f0528 100644
--- a/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.c
+++ b/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.c
@@ -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) ();
-- 
2.17.0

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-04-11  1:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-11  1:54 [PATCH] Fix compilation failure in gdb.arch/aarch64-tagged-pointer.c Simon Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).