aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHitoshi Mitake <h.mitake@gmail.com>2012-11-05 12:26:26 +0900
committerHitoshi Mitake <h.mitake@gmail.com>2012-11-05 22:34:43 +0900
commit5eb64357b1681652571831a11ad626c314408402 (patch)
tree0ae99e0f4ba0b3fd08ca321f7e0b94d89e02d2ef
parent943574aba54713ca4a17fe33aadde5abee233b53 (diff)
downloadtinycc-5eb64357b1681652571831a11ad626c314408402.tar.gz
tinycc-5eb64357b1681652571831a11ad626c314408402.tar.bz2
forbid invalid comparison of struct
Current tcc permits comparison of structs and comparison between struct and other typed values.
-rw-r--r--tccgen.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tccgen.c b/tccgen.c
index 4e58ef0..f183913 100644
--- a/tccgen.c
+++ b/tccgen.c
@@ -1700,6 +1700,8 @@ ST_FUNC void gen_op(int op)
(t2 & (VT_BTYPE | VT_UNSIGNED)) == (VT_LLONG | VT_UNSIGNED))
t |= VT_UNSIGNED;
goto std_op;
+ } else if (bt1 == VT_STRUCT || bt2 == VT_STRUCT) {
+ tcc_error("comparison of struct");
} else {
/* integer operations */
t = VT_INT;