https://bugs.kde.org/show_bug.cgi?id=436398
Bug ID: 436398 Summary: R NAs and NaN payload when converting 80-bit and 64-bit numbers on x87 Product: valgrind Version: 3.15 SVN Platform: Compiled Sources OS: Linux Status: REPORTED Severity: wishlist Priority: NOR Component: vex Assignee: jsew...@acm.org Reporter: tomas.kalib...@gmail.com Target Milestone: --- Created attachment 138026 --> https://bugs.kde.org/attachment.cgi?id=138026&action=edit Quick hack to preserve NaN payload which fixes observed issue. VEX does not preserve NaN payload bits when converting between 80-bit and 64-bit floating point numbers in convert_f80le_to_f64le and convert_f64le_to_f80le. This causes trouble when using valgrind to run R. R uses a special NaN payload to distinguish R NA ("missing") values from usual NaNs that result from floating point computations. One way to reproduce is to run R -d valgrind --quiet -e "sum(c(1, NA))" with R compiled with gcc -O0 (with -O2, different code is generated and the problem does not appear). I tried on Ubuntu 20.04 (gcc 9.3, valgrind 3.15.0) When R is run this way, the result is "NaN". When it is run without valgrind, it is "NA" (which it should be). It would be nice, if possible, if valgrind could match the underlying platform in this case. The attached patch is an experiment/hack which confirms the cause is convert_f80le_to_f64le/convert_f64le_to_f80le: with the patch applied, R returns "NA", matching the platform behavior, when running the example. -- You are receiving this mail because: You are watching all bug changes.