Skip to content

Commit f550b5a

Browse files
committed
Add regression test demonstrating a function pointer restriction bug
1 parent 5b6a99e commit f550b5a

File tree

2 files changed

+29
-0
lines changed
  • regression/goto-instrument/restrict-function-pointer-goto-target

2 files changed

+29
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include <assert.h>
2+
3+
typedef void (*fp_t)();
4+
5+
void f()
6+
{
7+
}
8+
9+
int main(void)
10+
{
11+
fp_t fp = f;
12+
goto L;
13+
14+
L:
15+
fp();
16+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
KNOWNBUG
2+
test.c
3+
--restrict-function-pointer main.function_pointer_call.1/f
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
\[main.assertion.1\] line \d+ dereferenced function pointer at main.function_pointer_call.1 must be f: SUCCESS
7+
--
8+
--
9+
This test checks that a function pointer call that is the target of a goto (in
10+
the goto program) is correctly handled. Currently there is a bug, as the
11+
function pointer labelling step which is part of the restrict function pointer
12+
feature inserts a new instructions before the function pointer calls, but does
13+
not adjust the goto targets.

0 commit comments

Comments
 (0)