Skip to content

Commit

Permalink
Add tests for #1421
Browse files Browse the repository at this point in the history
  • Loading branch information
karoliineh committed May 23, 2024
1 parent a0309d1 commit a2cedbf
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/regression/02-base/13-add-zero-to-struct-address.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <pthread.h>

struct a {
pthread_mutex_t b;
};
struct c {
struct a *conn;
} d();

int main() {
struct a str = {0};
struct c axel = {0};
axel.conn = &str;
pthread_mutex_t* ptr = &((axel.conn + 0)->b);
pthread_mutex_lock(ptr);
pthread_mutex_unlock(ptr);
}
17 changes: 17 additions & 0 deletions tests/regression/02-base/14-add-nondet-to-int-address.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <pthread.h>

struct a {
pthread_mutex_t b;
};
struct c {
struct a *conn;
} d();

int main() {
int str = {0};
struct c axel = {0};
axel.conn = &str;
pthread_mutex_t* ptr = (axel.conn + rand ());
pthread_mutex_lock(ptr);
pthread_mutex_unlock(ptr); // WARN
}

0 comments on commit a2cedbf

Please sign in to comment.