update_visitor::visit_target_symbol (e);
}
-static void initial_typeres_pass(systemtap_session& s);
-static void semantic_pass_const_fold (systemtap_session& s, bool& relaxed_p)
+static int initial_typeres_pass(systemtap_session& s);
+static int semantic_pass_const_fold (systemtap_session& s, bool& relaxed_p)
{
// attempt an initial type resolution pass to see if there are any type
// mismatches before we starting whisking away vars that get switched out
// with a const.
- initial_typeres_pass(s);
+
+ // return if the initial type resolution pass reported errors (type mismatches)
+ int rc = initial_typeres_pass(s);
+ if (rc)
+ {
+ relaxed_p = true;
+ return rc;
+ }
// Let's simplify statements with constant values.
const_folder cf (s, relaxed_p);
for (map<string,functiondecl*>::iterator it = s.functions.begin();
it != s.functions.end(); it++)
cf.replace (it->second->body);
+ return 0;
}
// that @defined expressions can be properly resolved. PR11360
// We also want it in case variables are used in if/case expressions,
// so enable always. PR11366
- semantic_pass_const_fold (s, relaxed_p);
+ // rc is incremented if there is an error that got reported.
+ rc += semantic_pass_const_fold (s, relaxed_p);
if (!s.unoptimized)
semantic_pass_dead_control (s, relaxed_p);
void visit_cast_op (cast_op* e) {}
};
-static void initial_typeres_pass(systemtap_session& s)
+static int initial_typeres_pass(systemtap_session& s)
{
// minimal type resolution based off of semantic_pass_types(), without
// checking for complete type resolutions or autocast expanding
else
ti.mismatch_complexity = 0;
}
+
+ return s.num_errors();
}
static int