aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdmund Grimley Evans <Edmund.Grimley.Evans@gmail.com>2015-11-22 00:00:36 +0000
committerEdmund Grimley Evans <Edmund.Grimley.Evans@gmail.com>2015-11-22 00:00:36 +0000
commit7301b42e362adb45120d4bb738deb18572ce4862 (patch)
treeaba0b3af14cad176c6fc8474c4b25694051aaa87
parent737f9842138aca6e4b6f44e26773288bb4dccd58 (diff)
downloadtinycc-7301b42e362adb45120d4bb738deb18572ce4862.tar.gz
tinycc-7301b42e362adb45120d4bb738deb18572ce4862.tar.bz2
tccgen.c: Try to make sizeof(!x) work.
tests/tests2/27_sizeof.*: Add test.
-rw-r--r--tccgen.c4
-rw-r--r--tests/tests2/27_sizeof.c2
-rw-r--r--tests/tests2/27_sizeof.expect1
3 files changed, 4 insertions, 3 deletions
diff --git a/tccgen.c b/tccgen.c
index 4e6a116..72e892c 100644
--- a/tccgen.c
+++ b/tccgen.c
@@ -3877,12 +3877,10 @@ ST_FUNC void unary(void)
vtop->c.i = !vtop->c.i;
} else if ((vtop->r & VT_VALMASK) == VT_CMP)
vtop->c.i ^= 1;
- else if (!nocode_wanted) {
+ else {
save_regs(1);
vseti(VT_JMP, gvtst(1, 0));
}
- else
- vtop--;
break;
case '~':
next();
diff --git a/tests/tests2/27_sizeof.c b/tests/tests2/27_sizeof.c
index d1694b6..5ae0ede 100644
--- a/tests/tests2/27_sizeof.c
+++ b/tests/tests2/27_sizeof.c
@@ -10,6 +10,8 @@ int main()
printf("%d\n", sizeof(b));
printf("%d\n", sizeof(c));
+ printf("%d\n", sizeof(!a));
+
return 0;
}
diff --git a/tests/tests2/27_sizeof.expect b/tests/tests2/27_sizeof.expect
index 7329e00..a47ea3a 100644
--- a/tests/tests2/27_sizeof.expect
+++ b/tests/tests2/27_sizeof.expect
@@ -1,3 +1,4 @@
1
4
8
+4