--- a/stage3/visit_expression_type.cc Thu Aug 25 17:55:48 2011 +0100
+++ b/stage3/visit_expression_type.cc Fri Aug 26 10:48:09 2011 +0100
@@ -2074,10 +2074,14 @@
if (hi2 != NULL) printf("%s", hi2->value);
printf("\n");
} // if (debug)
-
- if (!is_valid_assignment(left_type, right_type)) {
- STAGE3_ERROR(symbol, symbol, "data type mismatch in assignment statement!\n");
- }
+
+ if (NULL == left_type) {
+ STAGE3_ERROR(symbol->l_exp, symbol->l_exp, "Could not determine data type of expression (undefined variable or strcuture element?).\n");
+ } else if (NULL == right_type) {
+ STAGE3_ERROR(symbol->r_exp, symbol->r_exp, "Could not determine data type of expression (undefined variable or strcuture element?).\n");
+ } else if (!is_valid_assignment(left_type, right_type))
+ STAGE3_ERROR(symbol, symbol, "data type mismatch in assignment statement!\n");
+
return NULL;
}