You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rust uses the LLVM sdiv and udiv instructions for integer division, which have undefined results for division by zero. Using the current Rust compiler built from master on my 32-bit Linux machine, fn main() { log_err 1/0 } prints 0 when compiled with optimization. When compiled without optimization, it yields different results each time it is executed, for example 139268064.
I'm kind of suprised by both of these results; I'd have expected a hardware exception like the one that jruderman reported. Does clang do anything different for integer division? See this thread for some discussion (but no current solutions) from the LLVM point of view.
Activity
jruderman commentedon Sep 20, 2011
Task failure would be friendlier.
mbrubeck commentedon Nov 2, 2011
Rust uses the LLVM
sdivandudivinstructions for integer division, which have undefined results for division by zero. Using the current Rust compiler built from master on my 32-bit Linux machine,fn main() { log_err 1/0 }prints0when compiled with optimization. When compiled without optimization, it yields different results each time it is executed, for example139268064.I'm kind of suprised by both of these results; I'd have expected a hardware exception like the one that jruderman reported. Does clang do anything different for integer division? See this thread for some discussion (but no current solutions) from the LLVM point of view.
graydon commentedon Feb 15, 2012
Should trap SIGFPE and route to failure. Runtime issue.
Update benchmark.yml (rust-lang#944)
Use black_box instead of llvm_asm (rust-lang#944)
Merge rust-lang#944
Auto merge of rust-lang#944 - rust-lang:rustup, r=oli-obk
Merge pull request #944 from rust-lang/remove-failing-tests