aboutsummaryrefslogtreecommitdiffstats
path: root/csource
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2017-01-20 14:29:17 +0100
committerGitHub <noreply@github.com>2017-01-20 14:29:17 +0100
commitaffae90ec407a54751b799027e31a672d3914039 (patch)
treec1334f5c74f3965130bbdf34cd3daa354a6f4661 /csource
parent5d49e42c4457cc6d9a200658eb837bafa759f354 (diff)
parent9d7a67da1fc226035f2db52868400394ceba20ab (diff)
Merge pull request #112 from xairy/bitfields-fix
Bitfields fixes
Diffstat (limited to 'csource')
-rw-r--r--csource/common.go2
-rw-r--r--csource/csource.go2
2 files changed, 2 insertions, 2 deletions
diff --git a/csource/common.go b/csource/common.go
index f253083bf..004e5bbd2 100644
--- a/csource/common.go
+++ b/csource/common.go
@@ -148,7 +148,7 @@ static void install_segv_handler()
#define STORE_BY_BITMASK(type, addr, val, bf_off, bf_len) \
if ((bf_off) == 0 && (bf_len) == 0) { \
- *(type*)(addr) = (val); \
+ *(type*)(addr) = (type)(val); \
} else { \
type new_val = *(type*)(addr); \
new_val &= ~BITMASK_LEN_OFF(type, (bf_off), (bf_len)); \
diff --git a/csource/csource.go b/csource/csource.go
index 2d18e391a..316ac9297 100644
--- a/csource/csource.go
+++ b/csource/csource.go
@@ -202,7 +202,7 @@ loop:
if bfOff == 0 && bfLen == 0 {
fmt.Fprintf(w, "\tNONFAILING(*(uint%v_t*)0x%x = (uint%v_t)0x%x);\n", size*8, addr, size*8, arg)
} else {
- fmt.Fprintf(w, "\tNONFAILING(STORE_BY_BITMASK(uint%v_t, %v, %v, %v, %v);\n", size*8, addr, arg, bfOff, bfLen)
+ fmt.Fprintf(w, "\tNONFAILING(STORE_BY_BITMASK(uint%v_t, %v, %v, %v, %v));\n", size*8, addr, arg, bfOff, bfLen)
}
case prog.ExecArgResult:
fmt.Fprintf(w, "\tNONFAILING(*(uint%v_t*)0x%x = %v);\n", size*8, addr, resultRef())