diff options
| author | Andrey Konovalov <andreyknvl@google.com> | 2017-08-01 18:30:20 +0200 |
|---|---|---|
| committer | Andrey Konovalov <andreyknvl@google.com> | 2017-08-01 18:38:20 +0200 |
| commit | 1172db0ccf077bbfef7ddd176ced61c7140cb698 (patch) | |
| tree | d488163d92a1212d94bb8f6f65be7e9b8172cb7e /prog/encodingexec.go | |
| parent | 0b4392111b2785bac5b780848a5a88cc87bfd419 (diff) | |
prog: fix encoding for exec of result args
ResultArg might have const value.
Also add a test.
Diffstat (limited to 'prog/encodingexec.go')
| -rw-r--r-- | prog/encodingexec.go | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/prog/encodingexec.go b/prog/encodingexec.go index ba2efcd37..403b09f88 100644 --- a/prog/encodingexec.go +++ b/prog/encodingexec.go @@ -253,11 +253,19 @@ func (w *execContext) writeArg(arg Arg, pid int, csumMap map[Arg]CsumInfo) { w.write(a.Type().BitfieldOffset()) w.write(a.Type().BitfieldLength()) case *ResultArg: - w.write(ExecArgResult) - w.write(a.Size()) - w.write(w.args[a.Res].Idx) - w.write(a.OpDiv) - w.write(a.OpAdd) + if a.Res == nil { + w.write(ExecArgConst) + w.write(a.Size()) + w.write(a.Val) + w.write(0) // bit field offset + w.write(0) // bit field length + } else { + w.write(ExecArgResult) + w.write(a.Size()) + w.write(w.args[a.Res].Idx) + w.write(a.OpDiv) + w.write(a.OpAdd) + } case *PointerArg: w.write(ExecArgConst) w.write(a.Size()) |
