rust-lang / rust-lang/rust

ice: coroutine: attempted to add with overflow

Open
#118,951 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug I-ICE requires-debug-assertions T-compiler
Dominant language
Rust
Stars
119k
Forks
16.2k
PR merge metrics
PR metrics pending

Description

auto-reduced (treereduce-rust):

async fn empty() {}

async fn meow(a: [u8; 0xffff_ffff_ffff_ffff]) {
    empty().await;
    dbg!(a);
}


original:

async fn empty() {}

async fn meow(a: [u8; 0xffff_ffff_ffff_ffff]) {
	empty().await;
	dbg!(a);
}

fn main() {
	let v = meow([0, 4, 1, 5]);
	let e = [0u8; 202];
	let _ = || unsafe {
		use std::{mem, ptr};
		let mut copy = bar::read(&v);
		ptr::write(&mut copy, mem::transmute(ptr::read(&e)));
		mem::forget(copy);
	};
}

Version information

rustc 1.76.0-dev
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.76.0-dev
LLVM version: 17.0.5

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with compiler/rustc_mir_transform/src/coroutine.rs at line 2039 and reproduce the ICE using the reduced async Rust example in the issue. Trace the overflowing addition in coroutine transformation and verify that compiling the reduced case no longer panics with an overflow.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.