Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CIR][CodeGen][Bugfix] store fptr of a function with no args (llvm#622)
This PR fixes the next bug showed in the example below: ``` typedef int (*fn_t)(); int get42() { return 42; } void foo() { fn_t f = get42; } ``` The function type `fn_t` is generated as the variadic one due to no arg types listed, this is the `codegen` feature. And once we store the function pointer to a real function - a pointer to `get42` here has the expected `i32 ()*` type - we get a verification error, so `bitcast` is needed. The original `codegen` doesn't have it because of opaque pointers used, and had the `bitcast` earlier, long time ago: ``` %f = alloca i32 (...)* store i32 (...)* bitcast (i32 ()* @GET42 to i32 (...)*), i32 (...)** %f ```
- Loading branch information