Commit f95e9b3
fix(rustc_codegen_nvvm): Check function signatures before overriding libm functions. (Rust-GPU#206)
libm 0.2.13 refactored some of its implementations to use generic functions. The monomorphized function names clashed with the function names the codegen would override, causing it the codegen to override the function to a libdevice call that did not match the function signature. It then tries to patch this with a bitcast betwen floating point types, which are invalid casts.
This change adds an additional check before overriding. The libm function signature must match the libdevice intrinsic signature of the same name. Note that this prevents overrides even if bitcasts between the two argument types would be valid, which is likely another bug anyways.1 parent 491b502 commit f95e9b3
1 file changed
+23
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
6 | 9 | | |
7 | | - | |
| 10 | + | |
8 | 11 | | |
9 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
10 | 15 | | |
11 | 16 | | |
12 | 17 | | |
| |||
27 | 32 | | |
28 | 33 | | |
29 | 34 | | |
| 35 | + | |
30 | 36 | | |
31 | 37 | | |
32 | | - | |
33 | | - | |
34 | 38 | | |
35 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
36 | 53 | | |
37 | 54 | | |
38 | 55 | | |
| |||
0 commit comments