Fix code generation for XOR expressions in ST (add parenthesis)
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Tue, 17 Jan 2017 15:50:55 +0000
changeset 1026 fe580c0c1911
parent 1022 0d4d3a502d82
child 1027 675ee2eeb3ff
Fix code generation for XOR expressions in ST (add parenthesis)
stage4/generate_c/generate_c_st.cc
--- a/stage4/generate_c/generate_c_st.cc	Thu Sep 08 17:44:44 2016 +0100
+++ b/stage4/generate_c/generate_c_st.cc	Tue Jan 17 15:50:55 2017 +0000
@@ -593,7 +593,7 @@
 
 void *visit(xor_expression_c *symbol) {
   if (get_datatype_info_c::is_BOOL_compatible(symbol->datatype)) {
-    s4o.print("(");
+    s4o.print("((");
     symbol->l_exp->accept(*this);
     s4o.print(" && !");
     symbol->r_exp->accept(*this);
@@ -601,7 +601,7 @@
     symbol->l_exp->accept(*this);
     s4o.print(" && ");
     symbol->r_exp->accept(*this);
-    s4o.print(")");
+    s4o.print("))");
     return NULL;
   }
   if (get_datatype_info_c::is_ANY_nBIT_compatible(symbol->datatype))