aboutsummaryrefslogtreecommitdiff
path: root/i386-gen.c
diff options
context:
space:
mode:
authorMichael Matz <matz@suse.de>2016-03-26 17:57:22 +0100
committerMichael Matz <matz@suse.de>2016-03-26 17:57:22 +0100
commit80343ab7d829c21c65f8f9a14dd20158d028549f (patch)
tree0d5cf87dfcc350eaeeb71c6f5255d494f5e8879e /i386-gen.c
parent8fc5a6a2a49f05c358e293c79c0bf18e8eb4830e (diff)
downloadtinycc-80343ab7d829c21c65f8f9a14dd20158d028549f.tar.gz
tinycc-80343ab7d829c21c65f8f9a14dd20158d028549f.tar.bz2
Fix assignment to/from volatile types
Code like this was broken: char volatile vi = i; See testcase, happens in ideosyncratic legacy code sprinkling volatile all over.
Diffstat (limited to 'i386-gen.c')
-rw-r--r--i386-gen.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/i386-gen.c b/i386-gen.c
index c18b9c3..fc0748f 100644
--- a/i386-gen.c
+++ b/i386-gen.c
@@ -223,6 +223,8 @@ ST_FUNC void load(int r, SValue *sv)
ft = sv->type.t;
fc = sv->c.i;
+ ft &= ~(VT_VOLATILE | VT_CONSTANT);
+
v = fr & VT_VALMASK;
if (fr & VT_LVAL) {
if (v == VT_LLOCAL) {
@@ -298,6 +300,7 @@ ST_FUNC void store(int r, SValue *v)
ft = v->type.t;
fc = v->c.i;
fr = v->r & VT_VALMASK;
+ ft &= ~(VT_VOLATILE | VT_CONSTANT);
bt = ft & VT_BTYPE;
/* XXX: incorrect if float reg to reg */
if (bt == VT_FLOAT) {