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

pta-show tool not working due to llvm-pta-dump incorrect dot syntax output #455

Closed
Toaster192 opened this issue Nov 28, 2023 · 1 comment
Labels

Comments

@Toaster192
Copy link

Either the llvm-pta-dump tool is being called with incorrect arguments in the pta-show script or there is an issue in llvm-pta-dump that leads to the output not being in the correct .dot syntax.

Examples:

$ cat _ps.dot | head 
main::  %1 = alloca i32, align 4
  -> main::  %1 = alloca i32, align 4
main::  %2 = alloca %struct.Node*, align 8
  -> main::  %2 = alloca %struct.Node*, align 8
main::  %3 = alloca %struct.Node*, align 8
  -> main::  %3 = alloca %struct.Node*, align 8
main::  %4 = alloca %struct.Node*, align 8
  -> main::  %4 = alloca %struct.Node*, align 8
main::  %5 = alloca %struct.Node*, align 8
  -> main::  %5 = alloca %struct.Node*, align 8

or

$ ./dgtool pta-show  hello.c 
INFO: Pointer analysis took 0 sec 2 ms
Error: _ps.dot: syntax error in line 1 near 'main'
[dgtool]: command return non-zero status
$ cat _ps.dot 
main::  %1 = alloca i32, align 4
  -> main::  %1 = alloca i32, align 4
mchalupa added a commit that referenced this issue Nov 29, 2023
Dumping to graphviz works only for internal representation,
so it make sense to turn it on if `-dot` is required.
Other option would be to raise a warning or abort with the
message, but I think automatically turning that on is better.

Fixes #455.
@mchalupa
Copy link
Owner

mchalupa commented Nov 29, 2023

Thanks for reporting it. This is indeed a bug. The behavior of llvm-pta-dump was changed when a generic API for pointer analyses was introduced. llvm-pta-dump now uses this API to show the points-to sets. Dumping to graphviz is a feature that dumps the internal representation of points-to analyses (the pointer graph) and therefore must be used together with -ir option.

@mchalupa mchalupa added the bug label Nov 29, 2023
mchalupa added a commit that referenced this issue Nov 29, 2023
Dumping to graphviz works only for internal representation,
so it make sense to turn it on if `-dot` is required.
Other option would be to raise a warning or abort with the
message, but I think automatically turning that on is better.

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

No branches or pull requests

2 participants