Rust-GCC / gccrs

GCC Front-End for Rust
https://rust-gcc.github.io/
GNU General Public License v2.0
2.42k stars 156 forks source link

Compilation Error #1376

Closed joelsherrill closed 2 years ago

joelsherrill commented 2 years ago

Attempting to compile gccrs to target arm-rtems6 using a native gcc built from the gcc head. The last gccrs commit was:

`commit a273dbd971d337000155fe56a1d7cd78868caa9a (HEAD -> master, origin/staging, origin/master, origin/HEAD) Merge: 3f325921597 3ccf43082d2 Author: bors[bot] 26634292+bors[bot]@users.noreply.github.com Date: Fri Jul 8 18:19:34 2022 +0000

Merge #1374

1374: remove unused go code r=philberty a=philberty

This function is not used and we don't want to disable optimizations
randomly like this.

Co-authored-by: Philip Herron <philip.herron@embecosm.com>

` and compiling with gcc (not gccrs) built from gcc master:

$ gcc --version gcc (GCC) 13.0.0 20220710 (experimental) Copyright (C) 2022 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. I got this error:

In file included from ../../gccrs/gcc/rust/ast/rust-ast-full.h:22,
                 from ../../gccrs/gcc/rust/parse/rust-parse.h:21,
                 from ../../gccrs/gcc/rust/parse/rust-cfg-parser.cc:3:
../../gccrs/gcc/rust/ast/rust-ast.h:120:16: error: ‘virtual void Rust::AST::MacroMatch::accept_vis(Rust::AST::ASTVisitor&)’ was hidden [-Werror=overloaded-virtual=]
  120 |   virtual void accept_vis (ASTVisitor &vis) = 0;
      |                ^~~~~~~~~~
../../gccrs/gcc/rust/ast/rust-ast.h:223:8: note:   by ‘virtual void Rust::AST::Token::accept_vis(Rust::AST::ASTVisitor&)’
  223 |   void accept_vis (ASTVisitor &vis) override;
      |        ^~~~~~~~~~
../../gccrs/gcc/rust/ast/rust-ast.h:111:23: error: ‘virtual std::string Rust::AST::MacroMatch::as_string() const’ was hidden [-Werror=overloaded-virtual=]
  111 |   virtual std::string as_string () const = 0;
      |                       ^~~~~~~~~
../../gccrs/gcc/rust/ast/rust-ast.h:220:15: note:   by ‘virtual std::string Rust::AST::Token::as_string() const’
  220 |   std::string as_string () const override;
      |               ^~~~~~~~~
../../gccrs/gcc/rust/ast/rust-ast.h:593:16: error: ‘virtual void Rust::AST::AttrInput::accept_vis(Rust::AST::ASTVisitor&)’ was hidden [-Werror=overloaded-virtual=]
  593 |   virtual void accept_vis (ASTVisitor &vis) = 0;
      |                ^~~~~~~~~~
../../gccrs/gcc/rust/ast/rust-ast.h:798:8: note:   by ‘virtual void Rust::AST::DelimTokenTree::accept_vis(Rust::AST::ASTVisitor&)’
  798 |   void accept_vis (ASTVisitor &vis) override;
      |        ^~~~~~~~~~
../../gccrs/gcc/rust/ast/rust-ast.h:591:23: error: ‘virtual std::string Rust::AST::AttrInput::as_string() const’ was hidden [-Werror=overloaded-virtual=]
  591 |   virtual std::string as_string () const = 0;
      |                       ^~~~~~~~~
../../gccrs/gcc/rust/ast/rust-ast.h:796:15: note:   by ‘virtual std::string Rust::AST::DelimTokenTree::as_string() const’
  796 |   std::string as_string () const override;
      |               ^~~~~~~~~

I expected to see this happen: explanation

Instead, this happened: explanation

Meta

CohenArthur commented 2 years ago

Interesting. I wonder why these C++ errors didn't pop up on all our other builders. It might be due to using the latest version of gcc? I wonder if that happens on x86 as well

Zopolis4 commented 2 years ago

I'm using gcc 12.1, had no build fails, although I was disabling bootstrap (although most of a bootstrap build completed before that). There arent any changes in gcc that I can see https://gcc.gnu.org/gcc-13/changes.html that would have affected this code area.

philberty commented 2 years ago

It looks as though there has been a patch submitted to GCC master which might fix this for you:

commit 4c6567b4090d9363f90b5c68e238e7d0964b6e89
Author: Jason Merrill <jason@redhat.com>
Date:   Sun Jul 24 23:26:59 2022 -0400

    c++: -Woverloaded-virtual false positive [PR87729]

We usually build gccrs with our distro compiler at the moment.

philberty commented 2 years ago

@CohenArthur is going to check this for us :D

CohenArthur commented 2 years ago

Hi @joelsherrill,

I've tried building two gccs, before and after this commit which fixes some overzealous virtual methods warnings.

The "before" build failed with the same error as yours. The "after" one however completed without an issue. I did full bootstrap builds for both versions of gcc, to get as close to your scenario as possible. Hope it helps :)

philberty commented 2 years ago

This seems to be fixed since this commit to GCC HEAD https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=4c6567b4090d9363f90b5c68e238e7d0964b6e89