llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.04k stars 11.08k forks source link

[UBSAN] Call to function (unknown) through pointer to incorrect function type #32039

Open llvmbot opened 7 years ago

llvmbot commented 7 years ago
Bugzilla Link 32692
Version 4.0
OS Linux
Attachments Source code
Reporter LLVM Bugzilla Contributor
CC @efriedma-quic,@pcc

Extended Description

I have a program that dynamically links against a library. The program passes a function pointer to that library, to execute.

But the ubsan (Undefined Behavior Sanitizer) specified that the pointer is on an incorrect function type. And that occurs only

I use clang to compile my project.

The attached code is reduced to a simple test case. Check the comments to see where we can act to remove some warnings. But these fixes seem obvious.

llvmbot commented 7 years ago

The issue was previously posted to http://stackoverflow.com/questions/43220926/call-to-function-unknown-through-pointer-to-incorrect-function-type