From: jaruga@... Date: 2021-08-11T09:20:31+00:00 Subject: [ruby-core:104877] [Ruby master Bug#18073] test/ruby/test_jit.rb: "error: invalid use of '__builtin_va_arg_pack ()'" on Ruby 2.7.4 on gcc 4.8.5 Issue #18073 has been updated by jaruga (Jun Aruga). > It should be the default, unless you set CFLAGS at the command line or as the environment variable. As we chat, I confirmed the environment variable `CFLAGS` is not set before running `autoconf`, `./configure` again. The `CFLAGS: ${optflags} ${debugflags} ${warnflags}` is printed as an output of the `./configure`, but the actual value is `S["CFLAGS"]="-g -O2 -fPIC"` in `config.status`. ``` $ git checkout 29bbad939939c6dceb804aac667ba372fdee4ef5 $ git clean -fdx $ echo "CFLAGS: $CFLAGS" CFLAGS: $ env | grep CFLAGS $ echo $? 1 $ unset CFLAGS $ echo $? 0 $ autoconf $ ./configure --enable-shared 2>&1 | tee configure.log ... --- Configuration summary for ruby version 2.7.4 ... * CFLAGS: ${optflags} ${debugflags} ${warnflags} ... $ grep '"CFLAGS"' config.status S["CFLAGS"]="-g -O2 -fPIC" ``` I also compared the difference of the outputs of the `./configure --enable-shared`, sorting the result by the `sort` command to only see the essential differences. And here is the result of the difference. ``` $ \diff -u ok.fd95a18059.configure_sorted.log err.29bbad9399.configure_sorted.log --- ok.fd95a18059.configure_sorted.log 2021-08-11 09:10:44.858148283 +0000 +++ err.29bbad9399.configure_sorted.log 2021-08-11 09:11:11.689938763 +0000 @@ -507,7 +507,7 @@ checking grp.h presence... yes checking grp.h usability... yes checking host system type... x86_64-pc-linux-gnu -checking how to run the C preprocessor... gcc -std=gnu99 -E +checking how to run the C preprocessor... gcc -E checking ieeefp.h presence... no checking ieeefp.h usability... no checking if enum over int is allowed... yes @@ -543,7 +543,6 @@ checking pthread.h usability... yes checking pwd.h presence... yes checking pwd.h usability... yes -checking return type of signal handlers... void checking sanitizer/asan_interface.h presence... no checking sanitizer/asan_interface.h usability... no checking sanitizer/msan_interface.h presence... no @@ -694,7 +693,7 @@ checking whether dtrace USDT is available... no checking whether finite is declared... yes checking whether g++ accepts -g... no -checking whether gcc -std=gnu99 -E accepts -o... yes +checking whether gcc -E accepts -o... yes checking whether gcc -std=gnu99 needs -traditional... no checking whether gcc accepts -g... yes checking whether getenv is declared... yes ``` ---------------------------------------- Bug #18073: test/ruby/test_jit.rb: "error: invalid use of '__builtin_va_arg_pack ()'" on Ruby 2.7.4 on gcc 4.8.5 https://bugs.ruby-lang.org/issues/18073#change-93236 * Author: jaruga (Jun Aruga) * Status: Open * Priority: Normal * Backport: 2.6: UNKNOWN, 2.7: REQUIRED, 3.0: DONTNEED ---------------------------------------- I hit the following JIT test failures causing the following error on v2_7_4 tag (Ruby 2.7.4) with gcc 4.8.5 on RHEL 7. The tests work on Ruby 2.7.3 and also works on Ruby 3.0.2. ``` /mnt/git/ruby/ruby/.ext/include/x86_64-linux/rb_mjit_min_header-2.7.4.h: In function 'sprintf': /mnt/git/ruby/ruby/.ext/include/x86_64-linux/rb_mjit_min_header-2.7.4.h:442:3: error: invalid use of '__builtin_va_arg_pack ()' return __builtin___sprintf_chk (__s, 2 - 1, ^ ``` ``` $ which gcc /usr/bin/gcc $ gcc --version gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39) Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ git branch * (detached from v2_7_4) ... $ autoconf $ ./configure --enable-shared 2>&1 | tee configure.log $ make 2>&1 | tee make.log ``` Here is one of the failures. I would attach the full long files on this ticket. ``` $ make test-all TESTS="-v test/ruby/test_jit.rb" 2>&1 | tee make_test-all_test_jit.log ... 30) Failure: TestJIT#test_compile_insn_local [/mnt/git/ruby/ruby/test/ruby/test_jit.rb:62]: Expected 1 times of JIT success, but succeeded 0 times. script: """ p proc { foo = 1 foo }.call """ stderr: """ /mnt/git/ruby/ruby/.ext/include/x86_64-linux/rb_mjit_min_header-2.7.4.h: In function 'sprintf': /mnt/git/ruby/ruby/.ext/include/x86_64-linux/rb_mjit_min_header-2.7.4.h:442:3: error: invalid use of '__builtin_va_arg_pack ()' return __builtin___sprintf_chk (__s, 2 - 1, ^ compilation terminated due to -Wfatal-errors. Successful MJIT finish """ .. <1> expected but was <0>. ... Finished tests in 29.837252s, 3.1504 tests/s, 15.7186 assertions/s. 94 tests, 469 assertions, 87 failures, 0 errors, 4 skips ... ``` ---Files-------------------------------- configure.log (27.6 KB) make.log (102 KB) make_test-all_test_jit.log (77 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: