rust-lang / rust-lang/rustc_codegen_gcc
libgccjit testsuite seems to fail due to compile errors in libgccjit++.h
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.2k
- Forks
- 105
- Avg merge
- 8h 20m
- Merged PRs (30d)
- 14
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 https://github.com/rust-lang/gcc/commit/341be3b7d7ac6976cfed8ed59da3573c040d0776#diff-70af12ffc4a575792e96588dc518ccf7aacf05f74dfe08d7b931275015c030fe
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with gcc/jit/libgccjit++.h, comparing the gccjit::rvalue declaration and definition of set_type with the libgccjit API. Run the libgccjit testsuite, including jit/docs/examples/tut01-hello-world.cc, and confirm the examples compile without the reported declaration or type errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100