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

A null pointer exception is thrown when the ControlFlowGraphPass is registered #146

Closed
Cglasses opened this issue Feb 7, 2021 · 3 comments
Assignees
Labels
bug Something isn't working wip Work in Progress

Comments

@Cglasses
Copy link

Cglasses commented Feb 7, 2021

Test Code

extern void abort(void);
extern void __assert_fail(const char *, const char *, unsigned int, const char *) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__));
void reach_error() { __assert_fail("0", "array_doub_access_init_const.c", 3, "reach_error"); }
extern void abort(void);
void assume_abort_if_not(int cond) {
  if(!cond) {abort();}
}
void __VERIFIER_assert(int cond) { if(!(cond)) { ERROR: {reach_error();abort();} } }
int main()
{
  int i;
  int N=100000;
  int a[2*N+2];

  for(i=0;i<=N;i++) {
    a[2*i]=0;
    a[2*i+1]=0;
  }

  for(i=0;i<=2*N;i++)
    __VERIFIER_assert(a[i]>=0);
  return 0;
}

When I try to register ControlFlowGraphPass, the log shows that CXXLanguageFrontend Transform to CPG can be done, but then a null pointer exception will be thrown.
1
However when I unregister that Pass, it works.

@fwendland
Copy link
Collaborator

fwendland commented Feb 9, 2021

Thank you for reporting this bug. I took the liberty and reformatted your code sample.

I'll take a look and come back to you.

@fwendland fwendland added bug Something isn't working wip Work in Progress labels Feb 9, 2021
@fwendland fwendland self-assigned this Feb 9, 2021
@oxisto
Copy link
Member

oxisto commented Feb 9, 2021

The control flow pass is deprecated and we should really remove it or mark as deprecated in CPG.

@Cglasses
Copy link
Author

Cglasses commented Feb 9, 2021

The control flow pass is deprecated and we should really remove it or mark as deprecated in CPG.

Ok, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working wip Work in Progress
Projects
None yet
Development

No branches or pull requests

3 participants