You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed a segfault in the CIs, and after running miri on that test case for a whopping 12 hours, it managed to narrow down the issue onto build_meta_predicate_clause calling term_predicate_key(loader.machine_heap(), subterm_loc), where subterm_loc >= loader.machine_heap().cell_len().
The issue can be easily reproduced by adding a bounds check in impl std::ops::Index for Heap on rebis-dev: loads of tests suddenly break as a result, all emanating from build_meta_predicate_clause.
I'm not sure what build_meta_predicate_clause is supposed to do when it's called in this environment. For instance, it gets called with term.focus == 8373 and arity == 1 on the following heap segment:
From manually parsing it, we get that 8373 corresponds to once(G) :- call(G), !. or, in polish form, ':-'(once(G), ','(call(G), !)), but from inspecting the code calling build_meta_predicate_clause, I get that it is currently trying to expand the meta-predicate call/1.
As of now, build_meta_predicate_clause doesn't get fed with the proper address of the call (here 8362, the term argument to clause_to_query_term), and does replacements in incoherent locations (namely the arguments of ':-').
Okay, it looks like #2745 originates from somewhere else, since the clause given to build_meta_predicate_clause is already populated with module: prefixes, which puzzles me as to what build_meta_predicate_clause does. Making it return nothing passes all tests.
adri326
added a commit
to adri326/scryer-prolog
that referenced
this issue
Jan 9, 2025
I don't know if that function is still needed, as making it return Default::default()
still passes all tests.
Nonetheless, this is now one less source of segfaults.
Fixesmthom#2763
I noticed a segfault in the CIs, and after running miri on that test case for a whopping 12 hours, it managed to narrow down the issue onto
build_meta_predicate_clause
callingterm_predicate_key(loader.machine_heap(), subterm_loc)
, wheresubterm_loc >= loader.machine_heap().cell_len()
.The issue can be easily reproduced by adding a bounds check in
impl std::ops::Index for Heap
onrebis-dev
: loads of tests suddenly break as a result, all emanating frombuild_meta_predicate_clause
.I'm not sure what
build_meta_predicate_clause
is supposed to do when it's called in this environment. For instance, it gets called withterm.focus == 8373
andarity == 1
on the following heap segment:From manually parsing it, we get that
8373
corresponds toonce(G) :- call(G), !.
or, in polish form,':-'(once(G), ','(call(G), !))
, but from inspecting the code callingbuild_meta_predicate_clause
, I get that it is currently trying to expand the meta-predicatecall/1
.As of now,
build_meta_predicate_clause
doesn't get fed with the proper address of the call (here8362
, theterm
argument toclause_to_query_term
), and does replacements in incoherent locations (namely the arguments of':-'
).This might be the cause of #2745.
I'm working on a fix, but I wouldn't mind help :)
The text was updated successfully, but these errors were encountered: