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

Incompatible function pointer calls #389

Open
mchalupa opened this issue Apr 13, 2021 · 0 comments
Open

Incompatible function pointer calls #389

mchalupa opened this issue Apr 13, 2021 · 0 comments

Comments

@mchalupa
Copy link
Owner

In the following program, slicer generates an empty main (w.r.t assertion):

#include <assert.h>                                                                          
                                                                                   
int foo(void) {                                                                 
    assert(0);                                                                  
}                                                                               
                                                                                
int main() {                                                                    
    void (*f)() = foo;                                                          
    f();                                                                        
}                                                                               

The problem is that foo is not identified as a possible call target, because the declaration is not compatible with the function pointer. It is, in fact, undefined behavior. From C99 standard:

[UB is when] a pointer is used to call a function whose type is not compatible with the pointed-to type (6.3.2.3).

However, in real programs, such calls can be found, so maybe we could relax our default policy about compatibility of function pointers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant