-
Notifications
You must be signed in to change notification settings - Fork 269
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Function pointer removal: create fall-back function call
The case where a function pointer matches none of the candidate functions now introduces a call to a new function. No implementation of this function is provided, leaving the choice to the user in case they choose to use goto-instrument's generate-function-body. As doing so requires updates to goto_functions by the caller, two unused API variants of remove_function_pointers were removed. Fixes: #6983
- Loading branch information
1 parent
c00319e
commit 8c9b603
Showing
11 changed files
with
170 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
CORE | ||
main.c | ||
|
||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
\[f2.assertion.1\] line [0-9]+ assertion 0: SUCCESS | ||
\[main.assertion.1\] line [0-9]+ assertion x == 1: SUCCESS | ||
^\*\*\*\* WARNING: no body for function main::fptr_call | ||
^\*\*\*\* WARNING: no body for function main::fptr_call\$0 | ||
\[f2.assertion.1\] line [0-9]+ assertion 0: FAILURE | ||
\[main.assertion.1\] line [0-9]+ assertion x == 1: FAILURE | ||
\[main.assertion.2\] line [0-9]+ assertion x == 2: SUCCESS | ||
^VERIFICATION SUCCESSFUL$ | ||
^VERIFICATION FAILED$ | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
-- | ||
^warning: ignoring |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include <assert.h> | ||
|
||
struct PtrWrapper | ||
{ | ||
char *value_c; | ||
}; | ||
|
||
void fn(struct PtrWrapper wrapper) | ||
{ | ||
assert(wrapper.value_c == 'B'); | ||
} | ||
|
||
void indirect(int (*fn_ptr)(char *), char *data) | ||
{ | ||
fn_ptr(data); | ||
assert(0); | ||
} | ||
|
||
int main() | ||
{ | ||
struct PtrWrapper wrapper; | ||
wrapper.value_c = 'A'; | ||
|
||
int (*alias)(char *) = (int (*)(char *))fn; | ||
indirect(alias, &wrapper.value_c); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
CORE | ||
main.c | ||
|
||
^\*\*\*\* WARNING: no body for function indirect::fptr_call | ||
^\[indirect.assertion.1\] line 16 assertion 0: FAILURE$ | ||
^VERIFICATION FAILED$ | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
-- | ||
^warning: ignoring |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.