From: xtkoba+ruby@... Date: 2021-08-11T17:51:12+00:00 Subject: [ruby-core:104888] [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 xtkoba (Tee KOBAYASHI). It seems that in `configure.ac`, `AC_PROG_CC_C99` must come before `AC_PREPROC_IFELSE` to set `CPP` correctly. That is, ``` AC_INIT ac_cv_prog_cc_c99=-std=gnu99 AC_PROG_CC_C99 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[]])],[],[]) echo "CC:" "$CC" echo "CPP:" "$CPP" ``` works fine, while ``` AC_INIT ac_cv_prog_cc_c99=-std=gnu99 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[]])],[],[]) AC_PROG_CC_C99 echo "CC:" "$CC" echo "CPP:" "$CPP" ``` does not. The relevant part of `configure.ac` diff is shown below: ```diff --- ruby-2.7.3/configure.ac +++ ruby-2.7.4/configure.ac @@ -177,12 +180,14 @@ # clang version 1.0 (http://llvm.org/svn/llvm-project/cfe/tags/Apple/clang-23 exported) # Apple clang version 2.0 (tags/Apple/clang-137) (based on LLVM 2.9svn) # Apple clang version 2.1 (tags/Apple/clang-163.7.1) (based on LLVM 3.0svn) - AS_IF([! $CC -E -xc - </dev/null], [ - @%:@if defined __APPLE_CC__ && defined __clang_major__ && __clang_major__ < 3 - @%:@error premature clang - @%:@endif -SRC - AC_MSG_ERROR([clang version 3.0 or later is required]) + AC_PREPROC_IFELSE( + [AC_LANG_PROGRAM([ + @%:@if defined __APPLE_CC__ && defined __clang_major__ && __clang_major__ < 3 + @%:@error premature clang + @%:@endif + ])], + [], + [AC_MSG_ERROR([clang version 3.0 or later is required]) ])], [openbsd*:openbsd*], [ AC_CHECK_TOOLS(CC, [cc]) @@ -191,7 +196,9 @@ AC_CHECK_TOOL(CC, gcc) ]) -AC_PROG_CC_C99 +dnl Seems necessarily in order to add -std=gnu99 option for gcc 4.9. +m4_version_prereq([2.70], [], [AC_PROG_CC_C99]) + AS_CASE([$CC], [gcc-*], [ gcc_prefix=gcc- gcc_suffix=`echo "$CC" | sed 's/^gcc//'` ``` ---------------------------------------- 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-93248 * 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: