Skip to content

Commit 9bb0731

Browse files
authored
fix some SCC cycle mistakes (#49654)
1 parent 67dd21c commit 9bb0731

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/gf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3737,7 +3737,7 @@ static jl_value_t *ml_matches(jl_methtable_t *mt,
37373737
// now look for a third method m3 outside of this ambiguity group that fully resolves this intersection
37383738
size_t k;
37393739
for (k = agid; k > 0; k--) {
3740-
jl_method_match_t *matc3 = (jl_method_match_t*)jl_array_ptr_ref(env.t, k);
3740+
jl_method_match_t *matc3 = (jl_method_match_t*)jl_array_ptr_ref(env.t, k - 1);
37413741
jl_method_t *m3 = matc3->method;
37423742
if ((jl_subtype(ti, m3->sig) || (isect2 && jl_subtype(isect2, m3->sig)))
37433743
&& jl_type_morespecific((jl_value_t*)m3->sig, (jl_value_t*)m->sig)

src/staticdata_utils.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ static int has_backedge_to_worklist(jl_method_instance_t *mi, htable_t *visited,
178178
int depth = stack->len;
179179
*bp = (void*)((char*)HT_NOTFOUND + 4 + depth); // preliminarily mark as in-progress
180180
size_t i = 0, n = jl_array_len(mi->backedges);
181-
int cycle = 0;
181+
int cycle = depth;
182182
while (i < n) {
183183
jl_method_instance_t *be;
184184
i = get_next_edge(mi->backedges, i, NULL, &be);
@@ -194,7 +194,7 @@ static int has_backedge_to_worklist(jl_method_instance_t *mi, htable_t *visited,
194194
assert(cycle);
195195
}
196196
}
197-
if (!found && cycle && cycle != depth)
197+
if (!found && cycle != depth)
198198
return cycle + 3;
199199
// If we are the top of the current cycle, now mark all other parts of
200200
// our cycle with what we found.
@@ -1002,6 +1002,7 @@ static int jl_verify_graph_edge(size_t *maxvalids2_data, jl_array_t *edges, size
10021002
assert(jl_typeis((jl_value_t*)callee_ids, jl_array_int32_type));
10031003
int32_t *idxs = (int32_t*)jl_array_data(callee_ids);
10041004
size_t i, n = jl_array_len(callee_ids);
1005+
cycle = depth;
10051006
for (i = idxs[0] + 1; i < n; i++) {
10061007
int32_t childidx = idxs[i];
10071008
int child_cycle = jl_verify_graph_edge(maxvalids2_data, edges, childidx, visited, stack);
@@ -1020,7 +1021,7 @@ static int jl_verify_graph_edge(size_t *maxvalids2_data, jl_array_t *edges, size
10201021
}
10211022
}
10221023
size_t max_valid = maxvalids2_data[idx];
1023-
if (max_valid != 0 && cycle && cycle != depth)
1024+
if (max_valid != 0 && cycle != depth)
10241025
return cycle;
10251026
// If we are the top of the current cycle, now mark all other parts of
10261027
// our cycle with what we found.

0 commit comments

Comments
 (0)