Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion error in ast2ram: "variable not grounded" (functor example) #2474

Open
aaronbembenek opened this issue Mar 8, 2024 · 2 comments
Open

Comments

@aaronbembenek
Copy link

I tried this program

root@d769dccd107c:~# cat broken.dl
.type Pair = [x:number, y:number]
.functor mypair():Pair stateful

.decl P(x:number, y:number)
P(x, y) :- [x, y] = @mypair().
.output P

and got this assertion error:

root@d769dccd107c:~# souffle broken.dl
souffle: /root/souffle-mirror/src/ast2ram/seminaive/ValueTranslator.cpp:48: virtual souffle::Own<souffle::ram::Expression> souffle::ast2ram::seminaive::ValueTranslator::visit_(souffle::type_identity<souffle::ast::Variable>, const souffle::ast::Variable&): Assertion `index.isDefined(var.getName()) && "variable not grounded"' failed.
Aborted

I used the most recent version of Souffle:

root@d769dccd107c:~# souffle --version
----------------------------------------------------------------------------
Version: 2.4.1-19-gd8049888d
Word size: 32 bits
Options enabled: ffi openmp ncurses sqlite zlib
----------------------------------------------------------------------------
Copyright (c) 2016-22 The Souffle Developers.
Copyright (c) 2013-16 Oracle and/or its affiliates.
All rights reserved.
============================================================================

This might be the same underlying issue as #2213.

Unlike #2294 and #2318, there are no explicit inline qualifiers in this example.

@quentin
Copy link
Member

quentin commented Mar 11, 2024

Hi,
It is a current limitation of Soufflé: ADT and record values returned by a user-defined functor cannot get destructed into sub-parts. The semantics checker does not catch this limitation and eventually you get this assertion error.

Alternatively you can do this:

.decl Q(p:Pair)
Q(p) :- p = @mypair().
P(x,y) :- Q([x,y]).

I have a fix that is part of an ongoing work, although I cannot tell yet when it will land in master.

@aaronbembenek
Copy link
Author

Thanks for your response! I will work around it for now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants