-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
linking with C library changes the behavior of _Float16 #118813
Copy link
Copy link
Closed
Labels
A-floating-pointArea: Floating point numbers and arithmeticArea: Floating point numbers and arithmeticA-linkageArea: linking into static, shared libraries and binariesArea: linking into static, shared libraries and binariesC-bugCategory: This is a bug.Category: This is a bug.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessP-highHigh priorityHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-floating-pointArea: Floating point numbers and arithmeticArea: Floating point numbers and arithmeticA-linkageArea: linking into static, shared libraries and binariesArea: linking into static, shared libraries and binariesC-bugCategory: This is a bug.Category: This is a bug.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessP-highHigh priorityHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
I tried this code:
I expected to see this happen: It prints
114.Instead, this happened: It prints an unknown value,
0.00017929077,-0.045898438or other.After debugging, I found both
compiler_builtinsandlibgccprovide the symbol__extendhfsf2.__extendhfsf2is acompiler-rtintrinsics for casting a_Float16tofloat. Incompiler_builtins, the only argument of__extendhfsf2is passed in a general-proposed register, However, inlibgcc, the only argument of__extendhfsf2is passed inxmm.related: llvm/llvm-project#56854
Meta
rustc --version --verbose: