Add check whether external var matches to global var.
--- a/stage3/declaration_check.cc Thu Sep 27 18:14:52 2012 +0100
+++ b/stage3/declaration_check.cc Fri Sep 28 23:59:28 2012 +0200
@@ -96,7 +96,11 @@
/* found an external reference parameter. */
symbol_c *glo_decl = search_var_instance_glo_decl.get_decl(var_name);
symbol_c *ext_decl = search_var_instance_ext_decl.get_decl(var_name);
- if (search_var_instance_glo_decl.get_option(var_name) != search_var_instance_ext_decl.get_option(var_name))
+ if (glo_decl == NULL) {
+ STAGE3_ERROR(0, ext_decl, ext_decl, "Declaration error an external doesn't mach with any global var.");
+ continue;
+ }
+ if (search_var_instance_glo_decl.get_option(var_name) != search_var_instance_ext_decl.get_option(var_name))
STAGE3_ERROR(0, glo_decl, glo_decl, "Declaration error an external redefinition option.");
/* TODO: Check redefinition data type.