Correctly compute the type of an assignment expression.

This change enables following types of statements to work correctly:

    a = b = 3;
    if ((a = getchar()) < 0) { ... }

This fixes 2232082 acc: assignment in comparison segfaults
diff --git a/libacc/tests/data/assignment.c b/libacc/tests/data/assignment.c
new file mode 100644
index 0000000..4fc7801
--- /dev/null
+++ b/libacc/tests/data/assignment.c
@@ -0,0 +1,9 @@
+int main() {
+    int a = 0;
+    int b = 1;
+    a = b = 2; // Test that "b = 2" generates an rvalue.
+    if (a = 7) { // Test that a = 7 generates an rvalue.
+        b = 3;
+    }
+    return a;
+}
diff --git a/libacc/tests/test.py b/libacc/tests/test.py
index c982d16..d984301 100644
--- a/libacc/tests/test.py
+++ b/libacc/tests/test.py
@@ -426,6 +426,11 @@
 result: -2
 ""","""""")
 
+    def testAssignment(self):
+        self.compileCheck(["-R", "data/assignment.c"], """Executing compiled code:
+result: 7
+""","""""")
+
     def testArray(self):
         self.compileCheck(["-R", "data/array.c"], """Executing compiled code:
 localInt: 3