souffle icon indicating copy to clipboard operation
souffle copied to clipboard

Segmentation fault with ungrounded variable (record + inline)

Open adamjseitz opened this issue 2 years ago • 2 comments

Souffle generates a segmentation fault when printing error message for ungrounded variable in a record when the rule is inlined, see below. This occurs in release 2.3 and latest master (ecee065f54bea9f0caf7b7508b17577948c277ea).

test.dl:

.decl numbers(Num:unsigned)
.input numbers

.type record_t = [Num1:unsigned,Num2:unsigned]

.decl num_records_inline(Record:record_t) inline

num_records_inline([Num1,Num2_Ungrounded]):-
    numbers(Num1).

.decl num_records(Record:record_t)

num_records(Obj):-
    num_records_inline(Obj).
souffle -g test.cpp test.dl
Error: Ungrounded variable <inlined_<new_var_0>_0> in Segmentation fault (core dumped)

adamjseitz avatar Jul 12 '22 17:07 adamjseitz

This code should trigger the semantic checker because you have written the code (after inline expansion):

.decl numbers(Num:unsigned)
.input numbers

.type record_t = [Num1:unsigned,Num2:unsigned]

.decl num_records(Record:record_t)

num_records(Obj):-
    Obj=[Num1,Num2],                    
    numbers(Num1).

and Num2 is not a bound value.

b-scholz avatar Jul 18 '22 05:07 b-scholz

For this problem, the semantic checker needs to produce an error.

b-scholz avatar Jul 18 '22 05:07 b-scholz