aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/csource/csource.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-05-04 19:00:30 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-05-04 20:56:20 +0200
commit9941337c5f7cfa2f5c0d19c53f0bb9a2444f43ce (patch)
treebe744c67ea56a4d336c9d1abebbc9d0257ae1b21 /pkg/csource/csource.go
parent71db69869e82cce9af00f8660c6e867936b19212 (diff)
pkg/csource: init res var in generated call
It seems that gcc in ubuntu on travis got dumber: <stdin>: In function ‘execute_call’: <stdin>:1741:6: error: ‘res’ may be used uninitialized in this function [-Werror=maybe-uninitialized] cc1: all warnings being treated as errors compiler invocation: arm-linux-gnueabi-gcc [-o /tmp/syz-executor675297211 -DGOOS_linux=1 -DGOARCH_arm=1 -DHOSTGOOS_linux=1 -x c - -O2 -pthread -Wall -Werror -Wparentheses -Wframe-larger-than=16384 -D__LINUX_ARM_ARCH__=6 -march=armv6 -static -Wno-overflow] https://travis-ci.com/github/dvyukov/syzkaller/jobs/327487382 Though, we generate the same code and res seems to be initialized on all paths. Initialize it explicitly.
Diffstat (limited to 'pkg/csource/csource.go')
-rw-r--r--pkg/csource/csource.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/pkg/csource/csource.go b/pkg/csource/csource.go
index 84f458472..d2ab513cc 100644
--- a/pkg/csource/csource.go
+++ b/pkg/csource/csource.go
@@ -116,7 +116,7 @@ func (ctx *context) generateSyscalls(calls []string, hasVars bool) string {
}
} else {
if hasVars || opts.Trace {
- fmt.Fprintf(buf, "\tintptr_t res;")
+ fmt.Fprintf(buf, "\tintptr_t res = 0;\n")
}
fmt.Fprintf(buf, "\tswitch (call) {\n")
for i, c := range calls {