Hi tcc folks.

I found a trivial bug of tcc. Current tcc permits comparison of
structs and comparison between struct and other typed values. This
patch can fix the bug.

I'm new to tcc. Sorry if this patch contains wrong part.
I'd like to hear your comments.

v2: fix on the bug of mod branch
v3: fix the silly bug of v2

Thanks,
---
 tccgen.c |    2 ++
 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;
-- 
1.7.5.1


_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to