Bug #6592

test_call_double(DL::TestDL) fails on ARM HardFP

Added by Vit Ondruch about 3 years ago. Updated 9 months ago.

[ruby-core:45647]
Status:Closed
Priority:Normal
Assignee:Aaron Patterson
ruby -v:ruby 2.0.0dev (2012-06-05 trunk 35922) [armv7hl-linux] Backport:

Description

Hi,

I am observing following test suite error on armv7hl Fedora 17 1:

2) Failure:
test_call_double(DL::TestDL) [/builddir/build/BUILD/ruby-2.0.0-r35922/test/dl/test_dl2.rb:90]:
Expected |0.1 - 2.1638932342073e-311| (0.1) to be < 0.001.

I was digging a bit deeper and I identified issue in this part of code [2]. I tried a bit to unfold the macros and found, that the issue is because of variadic arguments. If the function prototype is declared without them (novar.disasm), the test passes, if they are in use (variadic.disasm), the test fails. The attached files shows the code with partially unfolded marcos and their disassembly. The atof.disasm contains the disassembly of the atof call if it might be of help.

I am not sure if it might be compiler bug (GCC 4.7) or if it should be fixed in Ruby. Any help appreciated

[1] http://arm.koji.fedoraproject.org/koji/getfile?taskID=904523&name=build.log
[2] https://github.com/ruby/ruby/blob/v1_9_3_195/ext/dl/cfunc.c#L464
[3] https://buildd.debian.org/status/fetch.php?pkg=ruby1.9.1&arch=armhf&ver=1.9.3.194-1&stamp=1338887114

novar.disasm - atof called without variadic arguments (659 Bytes) Vit Ondruch, 06/14/2012 05:12 PM

variadic.disasm - atof called with variadic arguments (699 Bytes) Vit Ondruch, 06/14/2012 05:12 PM

atof.disasm - atof disassembly (695 Bytes) Vit Ondruch, 06/14/2012 05:12 PM

noname (500 Bytes) Anonymous, 06/21/2012 01:53 AM

noname (500 Bytes) Anonymous, 06/22/2012 02:23 AM


Related issues

Blocked by Ruby trunk - Feature #5458: DL should be removed Closed 10/18/2011

History

#1 Updated by Vit Ondruch about 3 years ago

This might be of reference [1], particularly the 5.4 and 5.5 chapters.

[1] http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042d/IHI0042D_aapcs.pdf

#2 Updated by Motohiro KOSAKI about 3 years ago

Please confirm you are surely using fiddle (instead of plain DL). ext/dl is broken when the abi require proper function prototype for variadic arguments (e.g. x86_64).

#3 Updated by Vit Ondruch about 3 years ago

No I am not using Fiddle.

Better to say, it is not up to me what I use. The test is written in such way that it is using DL no matter if libffi is present and if Fiddle might be used.

This is the callstack using GitHub ;)

https://github.com/ruby/ruby/blob/trunk/ext/dl/cfunc.c#L340
https://github.com/ruby/ruby/blob/trunk/ext/dl/lib/dl/func.rb#L55
https://github.com/ruby/ruby/blob/trunk/test/dl/test_dl2.rb#L89

#4 Updated by Anonymous about 3 years ago

On Thu, Jun 14, 2012 at 09:54:41PM +0900, vo.x (Vit Ondruch) wrote:

Issue #6592 has been updated by vo.x (Vit Ondruch).

No I am not using Fiddle.

Better to say, it is not up to me what I use. The test is written in such way that it is using DL no matter if libffi is present and if Fiddle might be used.

I think we need to delete the CFunc code. The problem with that class
is we cannot tell the return type, so it's impossible to set up a fiddle
wrapper without using DL::CFunc in conjunction with DL::Function.

I'll port these tests to Fiddle in preparation for rm'ing the dl
implementation.

This is the callstack using GitHub ;)

https://github.com/ruby/ruby/blob/trunk/ext/dl/cfunc.c#L340
https://github.com/ruby/ruby/blob/trunk/ext/dl/lib/dl/func.rb#L55
https://github.com/ruby/ruby/blob/trunk/test/dl/test_dl2.rb#L89

Thank you! :-)

--
Aaron Patterson
http://tenderlovemaking.com/

#5 Updated by Vit Ondruch about 3 years ago

I think we need to delete the CFunc code. The problem with that class
is we cannot tell the return type, so it's impossible to set up a fiddle
wrapper without using DL::CFunc in conjunction with DL::Function.

I'll port these tests to Fiddle in preparation for rm'ing the dl
implementation.

In other words, DL will be removed in 2.0, but this leaves 1.9.3 on ARM with broken functionality? It would be nice to document it somewhere at least, if this is the case. Thank you.

#6 Updated by Anonymous about 3 years ago

On Thu, Jun 21, 2012 at 02:41:10PM +0900, vo.x (Vit Ondruch) wrote:

Issue #6592 has been updated by vo.x (Vit Ondruch).

I think we need to delete the CFunc code. The problem with that class
is we cannot tell the return type, so it's impossible to set up a fiddle
wrapper without using DL::CFunc in conjunction with DL::Function.

I'll port these tests to Fiddle in preparation for rm'ing the dl
implementation.

In other words, DL will be removed in 2.0, but this leaves 1.9.3 on ARM with broken functionality? It would be nice to document it somewhere at least, if this is the case. Thank you.

Not so much broken, as replaced with Fiddle. I don't think the CFunc
object is intended to be used directly (I couldn't find any usage in the
wild). But yes, if you're using CFunc directly, it will break. :(

--
Aaron Patterson
http://tenderlovemaking.com/

#7 Updated by Eric Hodel about 3 years ago

  • Category set to ext
  • Assignee set to Aaron Patterson
  • Target version set to 2.0.0

#8 Updated by Yusuke Endoh about 3 years ago

  • Status changed from Open to Assigned

#9 Updated by Yusuke Endoh over 2 years ago

  • Target version changed from 2.0.0 to next minor

#10 Updated by Zachary Scott almost 2 years ago

Aaron did you ever port these tests when you were merging bits of DL into Fiddle?

#11 Updated by Vit Ondruch 11 months ago

ping ... any update? Still an issue with ruby 2.2.0dev (2014-08-26 trunk 47288) [armv7hl-linux]

#12 Updated by Joel VanderWerf 11 months ago

Fails with gcc-4.8.2 also.

$ make check
  CC = gcc
  LD = ld
  LDSHARED = gcc -shared
  CFLAGS = -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=implicit-function-declaration -Werror=deprecated-declarations -Wno-packed-bitfield-compat -std=iso9899:1999 
  XCFLAGS = -D_FORTIFY_SOURCE=2 -fstack-protector -fno-strict-overflow -fvisibility=hidden -DRUBY_EXPORT -fPIE
  CPPFLAGS =   -I. -I.ext/include/armv7l-linux-eabihf -I./include -I.
  DLDFLAGS = -fstack-protector -pie  
  SOLIBS = 
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/4.8/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.8.2-19ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --disable-libitm --disable-libquadmath --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-armhf/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-armhf --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-armhf --with-arch-directory=arm --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --enable-multilib --disable-sjlj-exceptions --with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-mode=thumb --disable-werror --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
Thread model: posix
gcc version 4.8.2 (Ubuntu/Linaro 4.8.2-19ubuntu1) 

...

test succeeded
PASS all 1008 tests             
./miniruby -I./lib -I. -I.ext/common  ./tool/runruby.rb --extout=.ext  -- --disable-gems "./bootstraptest/runner.rb" --ruby="ruby --disable-gems"   ./KNOWNBUGS.rb
2014-09-01 10:34:38 -0700
Driver is ruby 2.2.0dev (2014-08-31 trunk 47341) [armv7l-linux-eabihf]
Target is ruby 2.2.0dev (2014-08-31 trunk 47341) [armv7l-linux-eabihf]

KNOWNBUGS.rb  PASS 0
No tests, no problem
./miniruby -I./lib -I. -I.ext/common  ./tool/runruby.rb --extout=.ext  -- --disable-gems "./test/runner.rb" --ruby="./miniruby -I./lib -I. -I.ext/common  ./tool/runruby.rb --extout=.ext  -- --disable-gems"  
Run options: "--ruby=./miniruby -I./lib -I. -I.ext/common  ./tool/runruby.rb --extout=.ext  -- --disable-gems"

# Running tests:

[  181/15519] DL::TestDL#test_call_double = 0.15 s                                          
  1) Failure:
DL::TestDL#test_call_double [/home/tmp/snapshot/test/dl/test_dl2.rb:63]:
Expected |0.1 - 2.1638938557735e-311| (0.1) to be <= 0.001.

[  834/15519] OpenSSL::TestPKeyRSA#test_sign_verify_memory_leak = 10.04 s                              
  2) Error:
OpenSSL::TestPKeyRSA#test_sign_verify_memory_leak:
Timeout::Error: execution of assert_no_memory_leak expired
    /home/tmp/snapshot/test/openssl/test_pkey_rsa.rb:80:in `test_sign_verify_memory_leak'

#13 Updated by Vit Ondruch 9 months ago

#14 Updated by Vit Ondruch 9 months ago

  • Status changed from Assigned to Closed

DL was removed in rev48217 (#5458) so this is not issue anymore. Thanks Aaron!

Also available in: Atom PDF