diff --git a/gcc/analyzer/analyzer.opt b/gcc/analyzer/analyzer.opt index 07bff339217..94a686db6b3 100644 --- a/gcc/analyzer/analyzer.opt +++ b/gcc/analyzer/analyzer.opt @@ -30,6 +30,10 @@ The maximum number of 'after supernode' exploded nodes within the analyzer per s Common Joined UInteger Var(param_analyzer_max_enodes_per_program_point) Init(8) Param The maximum number of exploded nodes per program point within the analyzer, before terminating analysis of that point. +-param=analyzer-max-constraints= +Common Joined UInteger Var(param_analyzer_max_constraints) Init(20) Param +The maximum number of constraints per state. + -param=analyzer-max-recursion-depth= Common Joined UInteger Var(param_analyzer_max_recursion_depth) Init(2) Param The maximum number of times a callsite can appear in a call stack within the analyzer, before terminating analysis of a call that would recurse deeper. diff --git a/gcc/analyzer/constraint-manager.cc b/gcc/analyzer/constraint-manager.cc index c10b770f294..e578e0502f2 100644 --- a/gcc/analyzer/constraint-manager.cc +++ b/gcc/analyzer/constraint-manager.cc @@ -940,6 +940,9 @@ constraint_manager::add_constraint_internal (equiv_class_id lhs_id, enum constraint_op c_op, equiv_class_id rhs_id) { + if (m_constraints.length () >= param_analyzer_max_constraints) + return; + constraint new_c (lhs_id, c_op, rhs_id); /* Remove existing constraints that would be implied by the