Skip to content

ICE: tree check: expected tree that contains ‘decl common’ structure, have ‘error_mark’ in setup_abi_options, at rust/backend/rust-compile-base.cc:452 #3668

Open
@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

//@compile-flags: -frust-incomplete-and-experimental-compiler-do-not-use
struct A {
    x: C,
    y: A,
}

#[repr(C)]
struct C {
    x: i32,
}

extern "C" {
    fn foo(x: A);

}

original:

#![deny(improper_ctypes)]
#![allow(dead_code)]

struct A {
    x: C,
    y: A
}

#[repr(C, packed)]
struct B {
    x: i32,
    y: C
}

#[repr(C)]
struct C {
    x: i32
}

type A2 = A;
type B2 = B;
type C2 = C;

#[repr(packed)]
struct D {
    x: C,
    y: A
}

extern "C" {
    fn foo(x: A); //~ ERROR type `A`, which is not FFI-safe
    fn bar(x: A2); //~ ERROR type `A`
    fn improper_ctypes(x: C);
    fn qux(x: A2); //~ ERROR type `A`
    fn quux(x: B2); //~ ERROR type `A`
    fn corge(x: C2);
    fn fred(x: D); //~ ERROR type `A`
}

fn main() { }

Version information:

7651217

Command:
/home/matthias/vcs/github/gccrs/gccrs-build/gcc/crab1 -frust-incomplete-and-experimental-compiler-do-not-use

Program output

crab1: internal compiler error: tree check: expected tree that contains ‘decl common’ structure, have ‘error_mark’ in setup_abi_options, at rust/backend/rust-compile-base.cc:452
0x9f521f tree_contains_struct_check_failed(tree_node const*, tree_node_structure_enum, char const*, int, char const*)
	../../gcc/tree.cc:9129
0x89bbd3 contains_struct_check(tree_node*, tree_node_structure_enum, char const*, int, char const*)
	../../gcc/tree.h:3758
0x89bbd3 Rust::Compile::HIRCompileBase::setup_abi_options(tree_node*, Rust::ABI)
	../../gcc/rust/backend/rust-compile-base.cc:452
0xd035ee Rust::Compile::CompileExternItem::visit(Rust::HIR::ExternalFunctionItem&)
	../../gcc/rust/backend/rust-compile-extern.h:148
0x10668c6 Rust::Compile::CompileExternItem::compile(Rust::HIR::ExternalItem*, Rust::Compile::Context*, Rust::TyTy::BaseType*, bool, unsigned int)
	../../gcc/rust/backend/rust-compile-extern.h:41
0x10668c6 Rust::Compile::CompileItem::visit(Rust::HIR::ExternBlock&)
	../../gcc/rust/backend/rust-compile-item.cc:288
0xcf15f4 Rust::Compile::CompileItem::compile(Rust::HIR::Item*, Rust::Compile::Context*, Rust::TyTy::BaseType*, unsigned int)
	../../gcc/rust/backend/rust-compile-item.h:37
0xcf15f4 Rust::Compile::CompileCrate::go()
	../../gcc/rust/backend/rust-compile.cc:48
0xcf16db Rust::Compile::CompileCrate::Compile(Rust::HIR::Crate&, Rust::Compile::Context*)
	../../gcc/rust/backend/rust-compile.cc:41
0xce90eb Rust::Session::compile_crate(char const*)
	../../gcc/rust/rust-session-manager.cc:733
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions