Open
Description
Sorry if this is not the right place to put this issue, I'm not sure where is the best place to file issues against the custom GCC.
ENV Info:
- I am running Gentoo Linux on aarch64, emulated inside QEMU, although I assume this bug appears as well on x86_64
- My host toolchain is running g++ 13.2.1
I downloaded, built, and run gcc as described in the README, with --enable-languages=jit,c++
After building libgccjit, I wanted to run the tests, but observed that all the tests failed:
PASS: ../jit/docs/examples/tut01-hello-world.c (test for excess errors)
Executing on host: /home/liam/rustc_gcc/gcc-build/gcc/testsuite/jit/../../xg++ -B/home/liam/rustc_gcc/gcc-build/gcc/testsuite/jit/../../ /home/liam/rustc_gcc/gcc/gcc/testsuite/../jit/docs/examples/tut01-hello-world.cc -fdiagnostics-plain-output -nostdinc++ -I/home/liam/rustc_gcc/gcc-build/aarch64-unknown-linux-gnu/libstdc++-v3/include/aarch64-unknown-linux-gnu -I/home/liam/rustc_gcc/gcc-build/aarch64-unknown-linux-gnu/libstdc++-v3/include -I/home/liam/rustc_gcc/gcc/libstdc++-v3/libsupc++ -I/home/liam/rustc_gcc/gcc/libstdc++-v3/include/backward -I/home/liam/rustc_gcc/gcc/libstdc++-v3/testsuite/util -fmessage-length=0 -I/home/liam/rustc_gcc/gcc/gcc/testsuite/../jit -lgccjit -g -Wall -Werror -rdynamic -L/home/liam/rustc_gcc/gcc-build/aarch64-unknown-linux-gnu/./libstdc++-v3/src/.libs -B/home/liam/rustc_gcc/gcc-build/aarch64-unknown-linux-gnu/./libstdc++-v3/src/.libs -L/home/liam/rustc_gcc/gcc-build/aarch64-unknown-linux-gnu/./libstdc++-v3/src/.libs -L/home/liam/rustc_gcc/gcc-build/aarch64-unknown-linux-gnu/./libstdc++-v3/src/experimental/.libs -B/home/liam/rustc_gcc/gcc-build/aarch64-unknown-linux-gnu/./libitm/ -L/home/liam/rustc_gcc/gcc-build/aarch64-unknown-linux-gnu/./libitm/.libs -lm -o tut01-hello-world.cc.exe (timeout = 300)
spawn -ignore SIGHUP /home/liam/rustc_gcc/gcc-build/gcc/testsuite/jit/../../xg++ -B/home/liam/rustc_gcc/gcc-build/gcc/testsuite/jit/../../ /home/liam/rustc_gcc/gcc/gcc/testsuite/../jit/docs/examples/tut01-hello-world.cc -fdiagnostics-plain-output -nostdinc++ -I/home/liam/rustc_gcc/gcc-build/aarch64-unknown-linux-gnu/libstdc++-v3/include/aarch64-unknown-linux-gnu -I/home/liam/rustc_gcc/gcc-build/aarch64-unknown-linux-gnu/libstdc++-v3/include -I/home/liam/rustc_gcc/gcc/libstdc++-v3/libsupc++ -I/home/liam/rustc_gcc/gcc/libstdc++-v3/include/backward -I/home/liam/rustc_gcc/gcc/libstdc++-v3/testsuite/util -fmessage-length=0 -I/home/liam/rustc_gcc/gcc/gcc/testsuite/../jit -lgccjit -g -Wall -Werror -rdynamic -L/home/liam/rustc_gcc/gcc-build/aarch64-unknown-linux-gnu/./libstdc++-v3/src/.libs -B/home/liam/rustc_gcc/gcc-build/aarch64-unknown-linux-gnu/./libstdc++-v3/src/.libs -L/home/liam/rustc_gcc/gcc-build/aarch64-unknown-linux-gnu/./libstdc++-v3/src/.libs -L/home/liam/rustc_gcc/gcc-build/aarch64-unknown-linux-gnu/./libstdc++-v3/src/experimental/.libs -B/home/liam/rustc_gcc/gcc-build/aarch64-unknown-linux-gnu/./libitm/ -L/home/liam/rustc_gcc/gcc-build/aarch64-unknown-linux-gnu/./libitm/.libs -lm -o tut01-hello-world.cc.exe^M
In file included from /home/liam/rustc_gcc/gcc/gcc/testsuite/../jit/docs/examples/tut01-hello-world.cc:20:^M
/home/liam/rustc_gcc/gcc/gcc/testsuite/../jit/libgccjit++.h:1772:1: error: no declaration matches 'void gccjit::rvalue::set_type(gccjit::type*)'^M
/home/liam/rustc_gcc/gcc/gcc/testsuite/../jit/libgccjit++.h:1772:1: note: no functions named 'void gccjit::rvalue::set_type(gccjit::type*)'^M
/home/liam/rustc_gcc/gcc/gcc/testsuite/../jit/libgccjit++.h:480:9: note: 'class gccjit::rvalue' defined here^M
compiler exited with status 1
FAIL: ../jit/docs/examples/tut01-hello-world.cc, initial compilation
I was able to create a patch that gets this test (and all the others failing for the same reason) working:
diff --git a/gcc/jit/libgccjit++.h b/gcc/jit/libgccjit++.h
index f3ee65cccd7..5fe00e95cb2 100644
--- a/gcc/jit/libgccjit++.h
+++ b/gcc/jit/libgccjit++.h
@@ -485,6 +485,7 @@ namespace gccjit
gcc_jit_rvalue *get_inner_rvalue () const;
type get_type ();
+ void set_type (type *new_type);
rvalue access_field (field field,
location loc = location ());
@@ -1771,7 +1772,7 @@ rvalue::get_type ()
inline void
rvalue::set_type (type *new_type)
{
- gcc_jit_rvalue_set_type (get_inner_rvalue (), new_type);
+ gcc_jit_rvalue_set_type (get_inner_rvalue (), new_type->get_inner_type ());
}
It seems this error was caused by rust-lang/gcc@341be3b#diff-70af12ffc4a575792e96588dc518ccf7aacf05f74dfe08d7b931275015c030fe