ah, that makes sense.

so the bug is in com.c where we use arith() to figure out the type
of the operation (which looks in a table indexed by the types
of both sides)? but we should instead just assign the type from
the left hand side?

just assigning t to n->type fixes the type, but why did it
call arith() in the first place?

--- a/sys/src/cmd/cc/com.c      Sun Sep 13 13:51:00 2015 +0200
+++ b/sys/src/cmd/cc/com.c      Sun Sep 13 19:59:43 2015 +0200
@@ -182,8 +182,8 @@
                        r = new1(OCAST, n->right, Z);
                        r->type = t;
                        n->right = r;
-                       n->type = t;
                }
+               n->type = t;
                break;

--
cinap

Reply via email to