Skip to content

Run cg_gcc tests with the correct compiler - #163533

Merged
rust-bors[bot] merged 4 commits into
rust-lang:mainfrom
Kobzol:cg-gcc-tests
Oct 4, 2026
Merged

rust-bors[bot] merged 4 commits into
rust-lang:mainfrom
Kobzol:cg-gcc-tests

Conversation

@Kobzol

@Kobzol Kobzol commented Sep 30, 2026

Copy link
Copy Markdown
Member

Seems like we have been running the tests with the stage 0 compiler all along :surprised: The tests crash with:

[BUILD] mini_core
[BUILD] example
[AOT] mini_core_hello_world
warning: the feature `never_type` has been stable since 1.101.0-dev and no longer requires an attribute to enable
 --> example/mini_core_hello_world.rs:4:44
  |
4 |     no_core, unboxed_closures, lang_items, never_type, linkage,
  |                                            ^^^^^^^^^^
  |
  = note: `#[warn(stable_features)]` on by default


thread 'rustc' (1671953) panicked at compiler/rustc_codegen_ssa/src/mir/rvalue.rs:1114:5:
assertion `left == right` failed
  left: __int8_t *  __attribute__((aligned(8)))
 right: void *
stack backtrace:
   0: __rustc::rust_begin_unwind
             at /rustc/cbae9b4cae2b108f6a3d18cfe6075714bb739463/library/std/src/panicking.rs:679:5
   1: core::panicking::panic_fmt
             at /rustc/cbae9b4cae2b108f6a3d18cfe6075714bb739463/library/core/src/panicking.rs:80:14
   2: core::panicking::assert_failed_inner
             at /rustc/cbae9b4cae2b108f6a3d18cfe6075714bb739463/library/core/src/panicking.rs:452:17
   3: core::panicking::assert_failed::<gccjit::types::Type, gccjit::types::Type>
             at /rustc/cbae9b4cae2b108f6a3d18cfe6075714bb739463/library/core/src/panicking.rs:407:5
   4: transmute_scalar<rustc_codegen_gcc::builder::Builder>
   5: codegen_transmute_operand<rustc_codegen_gcc::builder::Builder>
             at /home/bjorn/rust/compiler/rustc_codegen_ssa/src/mir/rvalue.rs:419:21
   6: codegen_rvalue_operand<rustc_codegen_gcc::builder::Builder>
             at /home/bjorn/rust/compiler/rustc_codegen_ssa/src/mir/rvalue.rs:625:30
   7: codegen_statement<rustc_codegen_gcc::builder::Builder>
             at /home/bjorn/rust/compiler/rustc_codegen_ssa/src/mir/statement.rs:37:52

I'll need help with resolving that from the cg_gcc side (CC @antoyo).

Fixes: #163527

@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 30, 2026
@antoyo

antoyo commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

Debug assertions are expected to be disabled for cg_gcc. This is a known issue.

@Kobzol

Kobzol commented Sep 30, 2026

Copy link
Copy Markdown
Member Author

So I should change bootstrap to compile cg_gcc without debug assertions, and that's it?

@antoyo

antoyo commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

So I should change bootstrap to compile cg_gcc without debug assertions, and that's it?

I'm not sure if it is cg_gcc or rustc that needs to be compiled without debug assertion.
In case that helps, my bootstrap.toml contains:

[rust]
codegen-backends = ["gcc"]
deny-warnings = false
debug-assertions = false
debug-assertions-std = false
lto = "off"

@bjorn3

bjorn3 commented Sep 30, 2026

Copy link
Copy Markdown
Member

cg_ssa needs to be compiled without debug assertions as the debug assertion that fails is in cg_ssa.

@Kobzol

Kobzol commented Sep 30, 2026

Copy link
Copy Markdown
Member Author

Hmm, that means that we'd have to run all cg_gcc tests without debug assertions. Well, doable, I guess, but annoying for local experiments.

@Kobzol

Kobzol commented Oct 2, 2026 •

Copy link
Copy Markdown
Member Author

Hmm, I realized that we don't actually run these tests in CI, unless I missed something. We only test UI tests and library tests at the moment (which is also why we didn't catch this earlier).

So I guess that we can already merge this as-is, it just won't work with debug assertions enabled. I at least added a warning.

@Kobzol
Kobzol marked this pull request as ready for review October 2, 2026 10:21
@rustbot

rustbot commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator

rustc_codegen_gcc is developed in its own repository. If possible, consider making this change to rust-lang/rustc_codegen_gcc instead.

cc @antoyo, @GuillaumeGomez

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 2, 2026
@rustbot

rustbot commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: bootstrap
  • bootstrap expanded to 6 candidates
  • Random selection from Mark-Simulacrum, clubby789, jieyouxu

@Kobzol

Kobzol commented Oct 2, 2026

Copy link
Copy Markdown
Member Author

r? bjorn3

@rustbot rustbot assigned bjorn3 and unassigned Mark-Simulacrum Oct 2, 2026

@GuillaumeGomez GuillaumeGomez left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For what it's worth, changes look good to me.

View changes since this review

Comment thread src/bootstrap/src/core/build_steps/test.rs
pattern_types,
thread_local
thread_local,
rustc_private

@bjorn3 bjorn3 Oct 2, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You will also need to change cg_gcc's build system to pass -Zforce-unstable-if-unmarked when testing mini_core and mini_core_hello_world. Otherwise this will result in a warning in cg_gcc's CI.

View changes since the review

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, done.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You will also need to change cg_gcc's build system to pass -Zforce-unstable-if-unmarked

Why is that? Could we just add the missing features in the code?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If #![feature(rustc_private)] is not used, everything works, except when -Zforce-unstable-if-unmarked is used (as it unconditionally is when testing through bootstrap). If -Zforce-unstable-if-unmarked is used, then the const stability checker will require #![feature(rustc_private)] to be set as the size_of intrinsic gets marked as unstable(rustc_private), yet it doesn't take into account that the entire crate is unstable(rustc_private) like the regular stability checker. But if -Zforce-unstable-if-unmarked is not set, then #![feature(rustc_private)] would be unused as nothing would get marked as unstable(rustc_private).

@bjorn3 bjorn3 added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 2, 2026
@Kobzol

Kobzol commented Oct 4, 2026

Copy link
Copy Markdown
Member Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 4, 2026
@bjorn3

bjorn3 commented Oct 4, 2026

Copy link
Copy Markdown
Member

@bors r+

@rust-bors

rust-bors Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

📌 Commit c3bee7b has been approved by bjorn3

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 4, 2026
rust-bors Bot pushed a commit that referenced this pull request Oct 4, 2026
…uwer

Rollup of 9 pull requests

Successful merges:

 - #161491 (Rip out old solver coherence)
 - #163533 (Run cg_gcc tests with the correct compiler)
 - #163223 (regression test for async handler normalization ICE)
 - #163367 (simplify rustc_log a bit)
 - #163622 (x86: c-variadic functions don't use registers with `-Zregparm`)
 - #163653 (callconv: mips64: Match GCC for alignment of 16-byte scalars)
 - #163665 (Parser: Refactor & better document `should_continue_as_assoc_expr` & `can_continue_expr_unambiguously`)
 - #163742 (Add the `movdir64b` and `movdiri` x86 target features)
 - #163752 (Revert "implement PartialEq<VecDeque<U>> for Vec<T>, &[T], &mut [T], [T; N], &[T; N] and &mut [T; N]")
@rust-bors
rust-bors Bot merged commit 762d317 into rust-lang:main Oct 4, 2026
14 checks passed
@rustbot rustbot added this to the 1.101.0 milestone Oct 4, 2026
rust-bors Bot pushed a commit that referenced this pull request Oct 4, 2026
Rollup merge of #163533 - Kobzol:cg-gcc-tests, r=bjorn3

Run cg_gcc tests with the correct compiler

Seems like we have been running the tests with the stage 0 compiler all along :surprised: The tests crash with:
```
[BUILD] mini_core
[BUILD] example
[AOT] mini_core_hello_world
warning: the feature `never_type` has been stable since 1.101.0-dev and no longer requires an attribute to enable
 --> example/mini_core_hello_world.rs:4:44
  |
4 |     no_core, unboxed_closures, lang_items, never_type, linkage,
  |                                            ^^^^^^^^^^
  |
  = note: `#[warn(stable_features)]` on by default

thread 'rustc' (1671953) panicked at compiler/rustc_codegen_ssa/src/mir/rvalue.rs:1114:5:
assertion `left == right` failed
  left: __int8_t *  __attribute__((aligned(8)))
 right: void *
stack backtrace:
   0: __rustc::rust_begin_unwind
             at /rustc/cbae9b4cae2b108f6a3d18cfe6075714bb739463/library/std/src/panicking.rs:679:5
   1: core::panicking::panic_fmt
             at /rustc/cbae9b4cae2b108f6a3d18cfe6075714bb739463/library/core/src/panicking.rs:80:14
   2: core::panicking::assert_failed_inner
             at /rustc/cbae9b4cae2b108f6a3d18cfe6075714bb739463/library/core/src/panicking.rs:452:17
   3: core::panicking::assert_failed::<gccjit::types::Type, gccjit::types::Type>
             at /rustc/cbae9b4cae2b108f6a3d18cfe6075714bb739463/library/core/src/panicking.rs:407:5
   4: transmute_scalar<rustc_codegen_gcc::builder::Builder>
   5: codegen_transmute_operand<rustc_codegen_gcc::builder::Builder>
             at /home/bjorn/rust/compiler/rustc_codegen_ssa/src/mir/rvalue.rs:419:21
   6: codegen_rvalue_operand<rustc_codegen_gcc::builder::Builder>
             at /home/bjorn/rust/compiler/rustc_codegen_ssa/src/mir/rvalue.rs:625:30
   7: codegen_statement<rustc_codegen_gcc::builder::Builder>
             at /home/bjorn/rust/compiler/rustc_codegen_ssa/src/mir/statement.rs:37:52
```

I'll need help with resolving that from the cg_gcc side (CC @antoyo).

Fixes: #163527
@Kobzol
Kobzol deleted the cg-gcc-tests branch October 5, 2026 06:27
rust-bors Bot pushed a commit that referenced this pull request Oct 8, 2026
Run cg_gcc tests with the correct compiler

Seems like we have been running the tests with the stage 0 compiler all along :surprised: The tests crash with:
```
[BUILD] mini_core
[BUILD] example
[AOT] mini_core_hello_world
warning: the feature `never_type` has been stable since 1.101.0-dev and no longer requires an attribute to enable
 --> example/mini_core_hello_world.rs:4:44
  |
4 |     no_core, unboxed_closures, lang_items, never_type, linkage,
  |                                            ^^^^^^^^^^
  |
  = note: `#[warn(stable_features)]` on by default

thread 'rustc' (1671953) panicked at compiler/rustc_codegen_ssa/src/mir/rvalue.rs:1114:5:
assertion `left == right` failed
  left: __int8_t *  __attribute__((aligned(8)))
 right: void *
stack backtrace:
   0: __rustc::rust_begin_unwind
             at /rustc/cbae9b4cae2b108f6a3d18cfe6075714bb739463/library/std/src/panicking.rs:679:5
   1: core::panicking::panic_fmt
             at /rustc/cbae9b4cae2b108f6a3d18cfe6075714bb739463/library/core/src/panicking.rs:80:14
   2: core::panicking::assert_failed_inner
             at /rustc/cbae9b4cae2b108f6a3d18cfe6075714bb739463/library/core/src/panicking.rs:452:17
   3: core::panicking::assert_failed::<gccjit::types::Type, gccjit::types::Type>
             at /rustc/cbae9b4cae2b108f6a3d18cfe6075714bb739463/library/core/src/panicking.rs:407:5
   4: transmute_scalar<rustc_codegen_gcc::builder::Builder>
   5: codegen_transmute_operand<rustc_codegen_gcc::builder::Builder>
             at /home/bjorn/rust/compiler/rustc_codegen_ssa/src/mir/rvalue.rs:419:21
   6: codegen_rvalue_operand<rustc_codegen_gcc::builder::Builder>
             at /home/bjorn/rust/compiler/rustc_codegen_ssa/src/mir/rvalue.rs:625:30
   7: codegen_statement<rustc_codegen_gcc::builder::Builder>
             at /home/bjorn/rust/compiler/rustc_codegen_ssa/src/mir/statement.rs:37:52
```

I'll need help with resolving that from the cg_gcc side (CC @antoyo).

Fixes: #163527
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

./x.py test compiler/rustc_codegen_gcc is broken

6 participants