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

fix condition bug in if statement #2

Closed
wants to merge 1 commit into from

Conversation

Yu3H0
Copy link

@Yu3H0 Yu3H0 commented Nov 24, 2024

Hello,

When I ran your code and watched the prompt, I noticed that this if statement was often empty when generating the z3 program, so I debugged it and now this code works fine for me.

@chengpeng-wang
Copy link
Owner

Hey. It seems to be caused by the version of tree-sitter. In specific versions, the AST node type of the conditions of if-statement are condition. However, in other versions, it isparenthesized_expression. Could you please report your tree-sitter version?

You can also refer to LLMSCAN, a standalone framework for LLM-based static analysis. We decouple the parsing module from LLMDFA and support multiple programming languages. We have tested in LLMSCAN and found this implementation works well: code.

@Yu3H0
Copy link
Author

Yu3H0 commented Nov 24, 2024

The version is consistent with the requirement.txt:

pip list | grep tree-sitter
tree-sitter                       0.20.2
tree-sitter-c                     0.21.4
tree-sitter-cpp                   0.22.2
tree-sitter-java                  0.21.0

@chengpeng-wang
Copy link
Owner

Sorry but I tried the code in LLMDFA and LLMSCAN while I could not reproduce the bug you encountered. Could you please share the program used for the analysis?

@Yu3H0
Copy link
Author

Yu3H0 commented Nov 26, 2024

Sorry for the late reply because of the final week, from my understanding of the code, the different program's don't seem to have an effect. I think it's a very small thing and it doesn't matter if you can't reproduce it on your end. How about this, I'll replace this pr with a new issue, and then that way if anyone else runs into the same problem as me, they'll see it and try to use this solution.

@chengpeng-wang
Copy link
Owner

Thanks for your report. Actually we encountered a similar bug previously. At that time, we realized it was caused by different versions tree-sitter. I am a bit confused why such bug still exists even if we have specified the version constraints in the requirements.txt. If someone else reports the same bug in the future, I will come back and have a look. Thx again.

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

Successfully merging this pull request may close these issues.

2 participants