Skip to content

Commit

Permalink
Add test case for issue #1267
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Schwarz <[email protected]>
  • Loading branch information
jerhard and michael-schwarz committed Nov 29, 2023
1 parent 7fa7bfd commit f6addb9
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/regression/01-cpa/75-update-local-via-global.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include<stdlib.h>
#include<goblint.h>
int g;
int* global = &g;

void fun() {
int top;
int top2;
int x;

if(top) {
global = &x;
}

x = 8;
if(top2) {
fun();
}
__goblint_check(x == 8); // UNKNOWN! We claim this holds, but it most not really hold: If top is false in the callee, it updates x to `5`

// May dereference x of previous invocation, should probably warn
*global = 5;
}

int main() {
fun();

*global = 8; //We should probably warn here for invalid deref (?)

fun();
}

0 comments on commit f6addb9

Please sign in to comment.