sim-se: fix a few bugs/warns from GCC 6
authorJoe Gross <joseph.gross@amd.com>
Wed, 18 Apr 2018 21:59:50 +0000 (17:59 -0400)
committerBrandon Potter <Brandon.Potter@amd.com>
Fri, 3 May 2019 19:16:34 +0000 (19:16 +0000)
Change-Id: Ib2ad860324fd234b23262d141be3e82628ff61f0
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/12126
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Brandon Potter <Brandon.Potter@amd.com>
Maintainer: Brandon Potter <Brandon.Potter@amd.com>

src/sim/syscall_emul.cc

index bfec1f5a581c0622ed7a9258985c4dedf2ccaf9e..98fbe96a0aab91938ba0dffcac5966e228e0da51 100644 (file)
@@ -848,12 +848,6 @@ SyscallReturn
 pipeImpl(SyscallDesc *desc, int callnum, Process *p, ThreadContext *tc,
          bool pseudoPipe)
 {
-    Addr tgt_addr = 0;
-    if (!pseudoPipe) {
-        int index = 0;
-        tgt_addr = p->getSyscallArg(tc, index);
-    }
-
     int sim_fds[2], tgt_fds[2];
 
     int pipe_retval = pipe(sim_fds);
@@ -883,6 +877,9 @@ pipeImpl(SyscallDesc *desc, int callnum, Process *p, ThreadContext *tc,
         return tgt_fds[0];
     }
 
+    int index = 0;
+    Addr tgt_addr = p->getSyscallArg(tc, index);
+
     /**
      * Copy the target file descriptors into buffer space and then copy
      * the buffer space back into the target address space.