PowerPC altivec
intrinsics are unsound due to subnormal flushing
#129886
Labels
A-floating-point
Area: Floating point numbers and arithmetic
C-bug
Category: This is a bug.
I-miscompile
Issue: Correct Rust code lowers to incorrect machine code
I-unsound
Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness
O-PowerPC
Target: PowerPC processors
P-medium
Medium priority
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
I tried this code, compiled on a PowerPC target with
-O -Ctarget-feature=+altivec
(-O -Ctarget-feature=-vsx
is required instead if the chosen PowerPC target uses a default target CPU ofpwr7
or later):I expected to see this happen: The program does not segfault.
Instead, this happened: The program segfaults as LLVM optimisations presume that subnormals are not flushed to zero, whereas the
altivec
instructions flush subnormals to zero. This only occurs when thevsx
feature is not enabled; thevsx
instructions do not flush subnormals and therefore do not have this issue.This is the PowerPC equivalent of #129880.
Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: