Skip to content

Conversation

dkm
Copy link
Member

@dkm dkm commented Jul 30, 2025

This is a sync with upstream GCC:

-- gerris 🦀

CohenArthur and others added 30 commits July 30, 2025 11:57
As discussed in
<https://inbox.sourceware.org/gcc-patches/[email protected]>:

> '-Werror=overloaded-virtual' is implied as by default, we have
> '-Woverloaded-virtual' and '-Werror'.

> '-Wno-unused-parameter' [did] move into
> 'rust-warn'

This reverts #1623 commit b322288.
As discussed in
<https://inbox.sourceware.org/gcc-patches/[email protected]>:

> '-Werror=overloaded-virtual' is implied as by default, we have
> '-Woverloaded-virtual' and '-Werror' [for '--enable-bootstrap' builds].
> ([...])
> (Maybe that isn't active for '--disable-bootstrap' builds, but that's
> "OK".)

For '--disable-bootstrap' builds, we still have '-Woverloaded-virtual', and any
new such diagnostics will be caught by the #1026 "check for new warnings"
machinery, so effectively that does implement '-Werror', too.

> '-Wno-unused-parameter' [did] move into
> 'rust-warn'

This reverts #1585 commit a32ef7a.
This reverts #1585 commit 94d1116.

Conflicts:
	.github/bors_log_expected_warnings
... manually resolved and adjusted; let's see...
(1) There is a need of the flag "-frust-incomplete-and-experimental-compiler-do-not-use" because the rust1 compiler didn't work without this.

(2) The gccrs was not present in the $HOME/gccrs-install/, so updated the path to $HOME/gccrs-install/bin

Signed-off-by: MAHAD <[email protected]>
This updates the CI to use ubuntu's latest LTS release, 22.04

ChangeLog:

	* .github/bors_log_expected_warnings: Update warnings.
	* .github/workflows/bootstrap.yml: Update Ubuntu version to 22.04.
	* .github/workflows/ccpp.yml: Likewise.
ChangeLog:

	* .github/bors.toml: Add commit checkers.
	* .github/workflows/commit-format.yml: Rename commit checker jobs.
ChangeLog:

	* .github/bors.toml: Remove checks for commit formats.
Now that we're using the Github merge queue, this is required to not
let the queue hanging.

ChangeLog:

	* .github/workflows/bootstrap.yml: Add missing `merge_group` trigger.
	* .github/workflows/ccpp.yml: Likewise.
	* .github/workflows/clang-format.yml: Likewise.
	* .github/workflows/commit-format.yml: Likewise.
We should probably think about building GCC 4.8 from source from time
to time and hosting the image on our Dockerhub, but I think this is okay
as well for now.

ChangeLog:

	* .github/workflows/ccpp.yml: Run GCC 4.8 action in ubuntu 18.04 container
ChangeLog:

	* .github/workflows/commit-format.yml: Skip job on PRs to master.
Check Signed-off-by/Reviewed-by/Co-authored-by lines are all grouped and
last in commit log.

ChangeLog:

	* .github/workflows/commit-format.yml: Check SoB lines are last.

Signed-off-by: Marc Poulhiès <[email protected]>
We do not need to set the system's compiler to `gccrs`, as we are mostly
interested in *having* gccrs - not necessarily using it as a C and C++
compiler as well.

ChangeLog:

	* Dockerfile: Remove update-alternatives invocation.

Co-authored-by: Marc Poulhiès <[email protected]>
Add the libgrust directory to the clang-format github action.

ChangeLog:

	* .github/workflows/clang-format.yml: Add libgrust directory.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
ChangeLog:

	* .github/workflows/bootstrap.yml:
	Run a bootstrap build nightly.

Signed-off-by: Owen Avery <[email protected]>
ChangeLog:

	* .github/workflows/bootstrap.yml: Bump checkout action version.
	* .github/workflows/ccpp.yml: Likewise.
	* .github/workflows/clang-format.yml: Likewise.
	* .github/workflows/docker.yml: Likewise.

Signed-off-by: Owen Avery <[email protected]>
ChangeLog:

	* .github/workflows/docker.yml: Bump docker action versions.

Signed-off-by: Owen Avery <[email protected]>
powerboat9 and others added 24 commits July 30, 2025 12:04
This should make it easier for us to handle attribute meta items of the
form <SimplePath> '=' <Expression> where the expression isn't a literal.
Some low hanging fruit remains here, but I think I should keep this
patch small as I had some trouble debugging it as-is (see:
Rust::Token::as_string vs Rust::Token::get_str vs
Rust::AST::Token::as_string).

gcc/rust/ChangeLog:

	* ast/rust-ast.cc: Include "rust-macro-invoc-lexer.h".
	(AttributeParser::~AttributeParser): Move function definition
	here.
	(AttributeParser::AttributeParser): Likewise and adjust member
	initialization.
	(AttributeParser::parse_meta_item_inner): Handle changes to
	peek_token.
	(AttributeParser::parse_literal): Likewise.
	(AttributeParser::parse_simple_path_segment): Likewise.
	(AttributeParser::parse_meta_item_seq): Handle changes to
	AttributeParser fields.
	(AttributeParser::peek_token): Move function definition here and
	wrap MacroInvocLexer.
	(AttributeParser::skip_token): Likewise.
	* ast/rust-macro.h (class MacroInvocLexer): Forward declare.
	(class Parser): Likewise.
	(AttributeParser::token_stream): Remove field.
	(AttributeParser::stream_pos): Likewise.
	(AttributeParser::lexer): New field.
	(AttributeParser::parser): Likewise.
	(AttributeParser::AttributeParser): Move definition to
	"rust-ast.cc".
	(AttributeParser::~AttributeParser): Likewise.
	(AttributeParser::peek_token): Likewise.
	(AttributeParser::skip_token): Likewise.

Signed-off-by: Owen Avery <[email protected]>
When we have generic paths like T::foobar during codegen sometimes we need
to enforce an extra lookup for this generic parameter type to the mono
morphized underlying type.

Fixes #3915
Fixes #1247

gcc/rust/ChangeLog:

	* backend/rust-compile-resolve-path.cc (HIRCompileBase::query_compile): do another lookup

gcc/testsuite/ChangeLog:

	* rust/compile/issue-3915.rs: New test.
	* rust/execute/torture/sip-hasher.rs: New test.

Signed-off-by: Philip Herron <[email protected]>
gcc/rust/ChangeLog:

	* expand/rust-expand-visitor.cc
	(ExpandVisitor::expand_inner_items): Adjust call to
	expand_macro_children.
	(ExpandVisitor::expand_inner_stmts): Likewise.
	(ExpandVisitor::visit): Likewise.
	* expand/rust-expand-visitor.h
	(ExpandVisitor::expand_macro_children): Take a pointer to member
	function instead of a std::function.

Signed-off-by: Owen Avery <[email protected]>
TopLevel would ignore just-loaded modules but Early and ExpandVisitor
wouldn't. The latter would produce errors when it hit attributes which
should have been indirectly CfgStrip'd away.

gcc/rust/ChangeLog:

	* expand/rust-cfg-strip.cc (CfgStrip::visit): Load unloaded
	modules.
	* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit):
	Assume modules have been loaded by CfgStrip.

Signed-off-by: Owen Avery <[email protected]>
This is important for importing enum variants as items.

gcc/rust/ChangeLog:

	* util/rust-hir-map.cc (Mappings::insert_ast_module): Rename to...
	(Mappings::insert_glob_container): ...this.
	(Mappings::lookup_ast_module): Rename to...
	(Mappings::lookup_glob_container): ...this.
	* util/rust-hir-map.h: Change declarations.
gcc/rust/ChangeLog:

	* resolve/rust-early-name-resolver-2.0.cc (Early::resolve_glob_import): Adapt for enums.
	(Early::finalize_glob_import): Likewise.
	* resolve/rust-early-name-resolver-2.0.h: Likewise.
	* resolve/rust-finalize-imports-2.0.cc (GlobbingVisitor::go): Likewise.
	(GlobbingVisitor::visit_module_container): New function.
	(GlobbingVisitor::visit_enum_container): New function.
	* resolve/rust-finalize-imports-2.0.h: Declare them.
	* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Insert enums as potential
	containers.

gcc/testsuite/ChangeLog:

	* rust/compile/glob_import_enum.rs: New test.
gcc/rust/ChangeLog:

	* ast/rust-expr.h: Add handling for deferred consts.
	* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise.
	* ast/rust-ast.cc (AnonConst::as_string): Likewise.
	(ArrayType::as_string): Likewise.
	* ast/rust-type.h (class ArrayType): Use AnonConst for sizes.
	* parse/rust-parse-impl.h (Parser::parse_anon_const): New function.
	(Parser::parse_slice_or_array_type): Call it.
	* parse/rust-parse.h: Declare it.
gcc/rust/ChangeLog:

	* hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Handle defered consts.
	* hir/tree/rust-hir-expr.cc (AnonConst::AnonConst): Likewise.
	(AnonConst::operator=): Likewise.
	* hir/tree/rust-hir-expr.h: Likewise.
	* hir/tree/rust-hir-visitor.cc (DefaultHIRVisitor::walk): Likewise.
	* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise.

gcc/testsuite/ChangeLog:

	* rust/compile/deferred_const_inference.rs: New test.
gcc/rust/ChangeLog:

	* ast/rust-expr.h: Fix formatting.
Since we are doing more and more "external" desugars, as in desugars
that take a pointer and replace it with another one, rather than
modifying it from within, having an external visitor dispatch to the
proper desugar helps with code clarity.

gcc/rust/ChangeLog:

	* Make-lang.in: Compile it.
	* rust-session-manager.cc: Call the expression desugar dispatcher.
	* ast/rust-desugar-question-mark.cc: Rework class API.
	* ast/rust-desugar-question-mark.h: Likewise.
	* ast/rust-expression-yeast.cc: New file.
	* ast/rust-expression-yeast.h: New file.
gcc/rust/ChangeLog:

	* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Visit a block's loop label if it
	exists.
This relies on the DefaultASTVisitor visitor for IfLetExprConseqElse
performing a virtual call of the visitor for IfLetExpr, which doesn't
hold when DefaultASTVisitor is generated by the X-macro-DSL-system I
have in another patch.

gcc/rust/ChangeLog:

	* resolve/rust-default-resolver.cc (DefaultResolver::visit): Add
	visitor for IfLetExprConseqElse.
	* resolve/rust-default-resolver.h (DefaultResolver::visit):
	Likewise.

Signed-off-by: Owen Avery <[email protected]>
gcc/rust/ChangeLog:

	* ast/rust-ast.h: Add the new variant.
	* ast/rust-expr.h: Use it for TryExpr class.
gcc/rust/ChangeLog:

	* Make-lang.in: Compile it.
	* ast/rust-expression-yeast.cc (ExpressionYeast::dispatch): Dispatch to try-block
	desugar.
	* ast/rust-desugar-try-block.cc: New file.
	* ast/rust-desugar-try-block.h: New file.

gcc/testsuite/ChangeLog:

	* rust/compile/try_block1.rs: New test.
gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit(SlicePattern)):
		Add new type check case for SliceType wrapped in ReferenceType.
	* backend/rust-compile-pattern.cc: Adjusted the asserts accordingly for
		CompilePatternCheckExpr(SlicePattern) & CompilePatternBindings(SlicePattern).

Signed-off-by: Yap Zhi Heng <[email protected]>
…inee

006t.original output from compiling testsuite/rust/compile/match-slicepattern-slice.rs:

...
  RUSTTMP.3 = slice;
  if (RUSTTMP.3.len == 1 && *(RUSTTMP.3.data + 0 * 4) == 1)
    {
      {
                struct () RUSTTMP.4;
        {

        }
        goto <D.129>;
      }
    }
  if (RUSTTMP.3.len == 2 && *(RUSTTMP.3.data + 1 * 4) == 2)
    {
      {
                struct () RUSTTMP.5;
        {

        }
        goto <D.129>;
      }
    }
  if (1)
    {
      {
                struct () RUSTTMP.6;
        {

        }
        goto <D.129>;
      }
    }
  <D.129>:;
...

gcc/rust/ChangeLog:

	* rust-backend.h: New slice_index_expression function.
	* rust-gcc.cc: Implementation of slice_index_expression to generate tree node for
		accessing slice elements.
	* backend/rust-compile-pattern.cc: Implement SlicePattern check expression & binding
		compilation against SliceType scrutinee.

Signed-off-by: Yap Zhi Heng <[email protected]>
gcc/rust/ChangeLog:

	* expand/rust-macro-builtins-asm.cc (expand_inline_asm_strings): Handle
	transformation for indexed positional arguments.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
gcc/rust/ChangeLog:

	* hir/rust-hir-dump.cc (Dump::visit): Dump inline assembly fields
	* hir/tree/rust-hir-expr.h: Add non const getter and avoid operand copy
	from getters.
	* hir/tree/rust-hir-visitor.cc (DefaultHIRVisitor::walk): Use non const
	reference.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
Previously inline assembly expected identifiers instead of expression.

gcc/rust/ChangeLog:

	* expand/rust-macro-builtins-asm.cc (parse_reg_operand_inout): Parse
	expressions and build split in out.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
Inline assembly was incomplete and input/output from inout or split in
out were not handled.

gcc/rust/ChangeLog:

	* backend/rust-compile-asm.cc (get_out_expr): Return valid output from
	an operand.
	(CompileAsm::asm_construct_outputs): Handle every output
	(get_in_expr): Return valid input from an operand.
	(CompileAsm::asm_construct_inputs): Handle every input

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
gcc/testsuite/ChangeLog:

	* rust/execute/inline_asm_inout_ident.rs: New test.
	* rust/execute/inline_asm_inout_var.rs: New test.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-base.cc
	(TypeCheckBase::TypeCheckBase): Remove initialization of
	resolver field.
	* typecheck/rust-hir-type-check-base.h
	(TypeCheckBase::resolver): Remove field.
	* typecheck/rust-hir-trait-resolve.cc: Remove "options.h"
	include.
	(TraitResolver::resolve_path_to_trait): Assume name resolution
	2.0 is always enabled.
	* typecheck/rust-hir-type-check-enumitem.cc: Remove "options.h"
	include.
	(TypeCheckEnumItem::visit): Assume name resolution 2.0 is always
	enabled.
	* typecheck/rust-hir-type-check-expr.cc: Remove "options.h"
	include.
	(TypeCheckExpr::visit): Assume name resolution 2.0 is always
	enabled.
	(TypeCheckExpr::resolve_operator_overload): Likewise.
	(TypeCheckExpr::resolve_fn_trait_call): Likewise.
	* typecheck/rust-hir-type-check-implitem.cc: Remove "options.h"
	include.
	(TypeCheckImplItem::visit): Assume name resolution 2.0 is always
	enabled.
	* typecheck/rust-hir-type-check-item.cc: Remove "options.h"
	include.
	(TypeCheckItem::visit): Assume name resolution 2.0 is always
	enabled.
	* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::visit):
	Likewise.
	(TypeCheckExpr::resolve_root_path): Likewise.
	(TypeCheckExpr::resolve_segments): Likewise.
	* typecheck/rust-hir-type-check-pattern.cc: Remove "options.h"
	include.
	(TypeCheckPattern::visit): Assume name resolution 2.0 is always
	enabled.
	* typecheck/rust-hir-type-check-type.cc
	(TypeCheckType::resolve_root_path): Likewise.
	(ResolveWhereClauseItem::visit): Likewise.
	* typecheck/rust-hir-type-check.cc: Remove "options.h" include.
	(TraitItemReference::get_type_from_fn): Assume name resolution
	2.0 is always enabled.
	* typecheck/rust-type-util.cc (query_type): Likewise.

Signed-off-by: Owen Avery <[email protected]>
Remove namespace comment after classes and structs.

gcc/rust/ChangeLog:

	* checks/errors/borrowck/rust-bir-fact-collector.h: Remove spurious
	comment.
	* checks/errors/rust-feature.cc: Likewise.
	* util/optional.h: Likewise.
	* expand/rust-token-tree-desugar.cc (TokenTreeDesugar::visit): Remove
	semicolons on namespace.
	* expand/rust-token-tree-desugar.h: Likewise.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
…-07-30

This branch has a no-op merge as the last commit:
 - one arm is the "current" development branch from github
 - the other arm is a rebased version of the "current" master branch onto a recent GCC's master

The merge is obtained with "git merge --strategy=ours" to only keep the changes from second arm.
@powerboat9
Copy link
Collaborator

What branch of gerris are you using?

@dkm
Copy link
Member Author

dkm commented Jul 31, 2025

What branch of gerris are you using?

dkm/upstream-command

I'm still experimenting

@CohenArthur
Copy link
Member

there is an issue with the selftests on Alpine 32. not sure if it is our fault or not

@thesamesam
Copy link
Contributor

thesamesam commented Aug 1, 2025

It's not, it'll go away on rebase. gerris picked a bad commit to sync at ;)

See https://gcc.gnu.org/PR121308

@dkm
Copy link
Member Author

dkm commented Aug 1, 2025

It's not, it'll go away on rebase. gerris picked a bad commit to sync at ;)

See https://gcc.gnu.org/PR121308

Looks like I've^gerris has been picking bad base revs for the lastest syncs. I'll respin this shortly, and thanks for chiming in @thesamesam ❤️

@dkm dkm closed this Aug 5, 2025
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

Successfully merging this pull request may close these issues.