From 5eb64357b1681652571831a11ad626c314408402 Mon Sep 17 00:00:00 2001 From: Hitoshi Mitake Date: Mon, 5 Nov 2012 12:26:26 +0900 Subject: [PATCH] forbid invalid comparison of struct Current tcc permits comparison of structs and comparison between struct and other typed values. --- tccgen.c | 2 ++ 1 file changed, 2 insertions(+) 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;