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

Semantic search returns no results #7

Open
keremc opened this issue Mar 8, 2022 · 4 comments
Open

Semantic search returns no results #7

keremc opened this issue Mar 8, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@keremc
Copy link
Contributor

keremc commented Mar 8, 2022

Semantic search returns no results.

Steps to reproduce the issue:

  1. Run Goblint & start an HTTP server in the run directory:
$ ./goblint --enable gobview tests/regression/03-practical/06-callback.c && cd run && python3 -m http.server
  1. Open the web UI. Scroll down until you see "Switch to JSON editor" and click it.
  2. Enter the following query and click "Execute":
{"kind":["var"],"target":["name","x"],"find":["uses"],"expression":"x == 5","mode":["Must"]}

If you save the same query in a file (e.g., query.json) and execute the semantic search in the terminal like this, it returns the expected results:

$ ./goblint tests/regression/03-practical/06-callback.c --set 'trans.activated[+]' expeval --set trans.expeval.query_file_name query.json
tests/regression/03-practical/06-callback.c:9:3-9:8 [16587]
tests/regression/03-practical/06-callback.c:19:3-19:17 [16685]
@sim642 sim642 added the bug Something isn't working label Mar 8, 2022
@sofamaniac
Copy link
Contributor

I have found the culprit.

let execute (q : t) cil =
if is_semantic q then (
ExpressionEvaluation.gv_query := Some q;
Maingoblint.do_analyze (Analyses.empty_increment_data cil) cil;
let results = !ExpressionEvaluation.gv_results in
let pred =
if q.mode = `Must then snd %> Option.default false else snd %> Option.default true
in
results |> List.filter pred |> List.map fst)

The pred filter filters everything out

@sim642
Copy link
Member

sim642 commented Mar 10, 2022

The real question then is why, because that pred hasn't recently been changed according to git blame, so the second components of results might've somehow changed to become all Some false or whatnot.

@michael-schwarz
Copy link
Member

goblint/analyzer#651 contains some discussions, but no fix yet. This should be looked into again!

@michael-schwarz
Copy link
Member

I'll check if this still happens.

@michael-schwarz michael-schwarz removed their assignment Aug 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants