From: "phasis68 (Heesob Park)" Date: 2012-05-08T23:18:54+09:00 Subject: [ruby-core:44946] [ruby-trunk - Bug #6407] Most Test Failure for BigDecimal on 64bit Windows, any GCC parameter needed? Issue #6407 has been updated by phasis68 (Heesob Park). This issue is related with sprintf "%zd" format which is a C99 feature. To enable sprintf "%zd" format, Ruby 1.9.3 defines macro _GNU_SOURCE. If _GNU_SOURCE is defined, MinGW32 defines __USE_MINGW_ANSI_STDIO macro. But MinGW64 ignores _GNU_SOURCE macro. The workaound is define macro __USE_MINGW_ANSI_STDIO like this: ./configure --build=x86_64-w64-mingw32 CFLAGS="-O2 -finline-functions -D__USE_MINGW_ANSI_STDIO" I am not sure this is a bug, but I found MinGW64 cannot handle -std=c99 flag in this case. Consider this: C:\work>type foo.c #include int main() { printf("%zd",(size_t)10); return 0; } C:\work>gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=c:/mingw47/mingw/bin/../libexec/gcc/i686-pc-mingw32/4.7.0/lt o-wrapper.exe Target: i686-pc-mingw32 Configured with: ../src/configure --prefix=/c/temp/gcc/dest --with-gmp=/c/temp/g cc/gmp --with-mpfr=/c/temp/gcc/mpfr --with-mpc=/c/temp/gcc/mpc --enable-language s=c,c++ --with-arch=i686 --with-tune=generic --disable-libstdcxx-pch --disable-n ls --disable-shared --disable-sjlj-exceptions --disable-win32-registry --enable- checking=release --enable-lto Thread model: win32 gcc version 4.7.0 (GCC) C:\work>gcc -std=c99 foo.c -ofoo.exe C:\work>foo 10 C:\work>gcc -D_GNU_SOURCE foo.c -ofoo.exe C:\work>foo 10 C:\work>gcc -D__USE_MINGW_ANSI_STDIO foo.c -ofoo.exe C:\work>foo 10 C:\work>gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=c:/mingw64_7/bin/../libexec/gcc/x86_64-w64-mingw32/4.7.0/lto -wrapper.exe Target: x86_64-w64-mingw32 Configured with: ../gcc-4.7.0/configure --build=x86_64-w64-mingw32 --enable-targ ets=all --disable-multilib --enable-64bit --prefix=/mingw64 --with-sysroot=/ming w64 --disable-shared --enable-static --disable-nls --enable-version-specific-run time-libs --disable-win32-registry --without-dwarf2 --enable-sjlj-exceptions --e nable-fully-dynamic-string --enable-languages=c,ada,lto,c++,objc,obj-c++,fortran --enable-libgomp --enable-lto --enable-libssp -enable-gnattools --disable-boots trap --with-gcc --with-gnu-as --with-gnu-ld --with-stabs --enable-interwork --wi th-mpfr-include=/home/beta/gcc-build/../gcc-4.7.0/mpfr/src --with-mpfr-lib=/home /beta/gcc-build/mpfr/src/.libs Thread model: win32 gcc version 4.7.0 (GCC) C:\work>gcc -std=c99 foo.c -ofoo.exe C:\work>foo zd C:\work>gcc -D_GNU_SOURCE foo.c -ofoo.exe C:\work>foo zd C:\work>gcc -D__USE_MINGW_ANSI_STDIO foo.c -ofoo.exe C:\work>foo 10 ---------------------------------------- Bug #6407: Most Test Failure for BigDecimal on 64bit Windows, any GCC parameter needed? https://bugs.ruby-lang.org/issues/6407#change-26534 Author: raylinn@gmail.com (ray linn) Status: Open Priority: Normal Assignee: mrkn (Kenta Murata) Category: Target version: ruby -v: ruby 1.9.3p194 (2012-04-20) [x64-mingw32] Compiled with MinGW64, GCC (4.6.3) or (GCC 4.7.0), configure as ./configure --build=x86_64-w64-mingw32 CFLAGS="-O2 -finline-functions -I/usr/local/include" LDFLAGS="-L/usr/local/lib" ,after compiled, zero error on make test. but when make test-all, a lot of issue reported on BigDeciaml, I tried to add -mieee-fp,but issue is still,any extra parameter i need for gcc? The failure items: test_big_decimal_round_trip(Psych::TestNumeric): TypeError: load failed: invalid character in the marshaled string C:/msys/1.0/home/beta/ruby-1.9.3-p194/.ext/common/psych/visitors/to_ruby.rb:62:in `_load' C:/msys/1.0/home/beta/ruby-1.9.3-p194/.ext/common/psych/visitors/to_ruby.rb:62:in `deserialize' C:/msys/1.0/home/beta/ruby-1.9.3-p194/.ext/common/psych/visitors/to_ruby.rb:104:in `visit_Psych_Nodes_Scalar' C:/msys/1.0/home/beta/ruby-1.9.3-p194/.ext/common/psych/visitors/visitor.rb:15:in `visit' C:/msys/1.0/home/beta/ruby-1.9.3-p194/.ext/common/psych/visitors/visitor.rb:5:in `accept' C:/msys/1.0/home/beta/ruby-1.9.3-p194/.ext/common/psych/visitors/to_ruby.rb:20:in `accept' C:/msys/1.0/home/beta/ruby-1.9.3-p194/.ext/common/psych/visitors/to_ruby.rb:231:in `visit_Psych_Nodes_Document' C:/msys/1.0/home/beta/ruby-1.9.3-p194/.ext/common/psych/visitors/visitor.rb:15:in `visit' C:/msys/1.0/home/beta/ruby-1.9.3-p194/.ext/common/psych/visitors/visitor.rb:5:in `accept' C:/msys/1.0/home/beta/ruby-1.9.3-p194/.ext/common/psych/visitors/to_ruby.rb:20:in `accept' C:/msys/1.0/home/beta/ruby-1.9.3-p194/.ext/common/psych/nodes/node.rb:35:in `to_ruby' C:/msys/1.0/home/beta/ruby-1.9.3-p194/.ext/common/psych.rb:128:in `load' C:/msys/1.0/home/beta/ruby-1.9.3-p194/test/psych/helper.rb:35:in `assert_cycle' C:/msys/1.0/home/beta/ruby-1.9.3-p194/test/psych/test_numeric.rb:22:in `test_big_decimal_round_trip' 5) Failure: test_BigMath_exp(TestBigDecimal) [C:/msys/1.0/home/beta/ruby-1.9.3-p194/test/bigdecimal/test_bigdecimal.rb:1170]: Expected 485165195.4097903 - 0.48516519540979027797Ezd (485165194.9246251) to be < 0.00048516519540979026. 6) Failure: test_BigMath_log_with_42(TestBigDecimal) [C:/msys/1.0/home/beta/ruby-1.9.3-p194/test/bigdecimal/test_bigdecimal.rb:1265]: Expected 3.7376696182833684 - 0.3737669618283368305917830101823881909945797027394132Ezd (3.3639026564550316) to be < 0.001. 7) Failure: test_BigMath_log_with_exp_1(TestBigDecimal) [C:/msys/1.0/home/beta/ruby-1.9.3-p194/test/bigdecimal/test_bigdecimal.rb:1251]: Expected 1.0 - 0.10000000000000000000146094228462874163031819506060204Ezd (0.9) to be < 0.001. 8) Failure: test_BigMath_log_with_reciprocal_of_42(TestBigDecimal) [C:/msys/1.0/home/beta/ruby-1.9.3-p194/test/bigdecimal/test_bigdecimal.rb:1271]: Expected -96.70857390574992 - -0.96708573905749918728755641096743294420914068228418976Ezd (95.74148816669242) to be < 0.001. 9) Failure: test_BigMath_log_with_square_of_exp_2(TestBigDecimal) [C:/msys/1.0/home/beta/ruby-1.9.3-p194/test/bigdecimal/test_bigdecimal.rb:1261]: Expected 2 - 0.2000000000000000000029218845692574815541912638608018Ezd (0.29218845692574815541912638608018Ezd) to be < 0.001. 10) Failure: test_exp_with_1(TestBigDecimal) [C:/msys/1.0/home/beta/ruby-1.9.3-p194/test/bigdecimal/test_bigdecimal.rb:1165]: Expected 2.718281828459045 - 0.27182818284590452354Ezd (2.4464536456131407) to be < 0.002718281828459045. 11) Failure: test_inspect(TestBigDecimal) [C:/msys/1.0/home/beta/ruby-1.9.3-p194/test/bigdecimal/test_bigdecimal.rb:811]: Expected /^#$/ to match "#". 12) Error: test_marshal(TestBigDecimal): TypeError: load failed: invalid character in the marshaled string C:/msys/1.0/home/beta/ruby-1.9.3-p194/test/bigdecimal/test_bigdecimal.rb:468:in `_load' C:/msys/1.0/home/beta/ruby-1.9.3-p194/test/bigdecimal/test_bigdecimal.rb:468:in `load' C:/msys/1.0/home/beta/ruby-1.9.3-p194/test/bigdecimal/test_bigdecimal.rb:468:in `test_marshal' 13) Failure: test_power_of_three(TestBigDecimal) [C:/msys/1.0/home/beta/ruby-1.9.3-p194/test/bigdecimal/test_bigdecimal.rb:898]: Expected 0.012345679012345678 - 0.12345679012345679012345679012345679012345679012345679012345679Ezd (0.1111111111111111) to be < 0.001. 14) Failure: test_to_f(TestBigDecimal) [C:/msys/1.0/home/beta/ruby-1.9.3-p194/test/bigdecimal/test_bigdecimal.rb:527]: <1.0> expected but was <0.1>. 15) Failure: test_to_s(TestBigDecimal) [C:/msys/1.0/home/beta/ruby-1.9.3-p194/test/bigdecimal/test_bigdecimal.rb:786]: <"0.1234567890123456789E3"> expected but was <"0.1234567890123456789Ezd">. 16) Failure: test_atan(TestBigMath) [C:/msys/1.0/home/beta/ruby-1.9.3-p194/test/bigdecimal/test_bigmath.rb:59]: Expected 1.5707963267948966 - 0.15707963267948966192Ezd (1.413716694115407) to be < 0.001. 17) Failure: test_const(TestBigMath) [C:/msys/1.0/home/beta/ruby-1.9.3-p194/test/bigdecimal/test_bigmath.rb:13]: Expected 3.141592653589793 - 0.3141592653589793238462643383279502883919859293521427Ezd (2.827433388230814) to be < 0.001. 18) Failure: test_cos(TestBigMath) [C:/msys/1.0/home/beta/ruby-1.9.3-p194/test/bigdecimal/test_bigmath.rb:42]: Expected 1.0 - 0.1Ezd (0.9) to be < 0.001. -- http://bugs.ruby-lang.org/