Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libgccjit testsuite seems to fail due to compile errors in libgccjit++.h #536

Open
liamnaddell opened this issue Jul 3, 2024 · 3 comments

Comments

@liamnaddell
Copy link

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

@antoyo
Copy link
Contributor

antoyo commented Jul 3, 2024

Thanks for raising the issue.
Indeed, we're having a lot of trouble doing the sync of rustc_codegen_gcc with the Rust repo, and I indeed left the GCC repo in a state where some tests fail: sorry about that.
Is this causing any issue for you?
If so, I can fix it tomorrow.

@liamnaddell
Copy link
Author

I was interested in the testsuite because the README suggested running the check-jit target. I'm guessing that a bad libgccjit++.h won't impact the rust backend, so if it's not worth fixing, it wouldn't impact me at all.

@antoyo
Copy link
Contributor

antoyo commented Jul 3, 2024

It won't impact this project indeed, but I will fix these tests in the coming weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants