Skip to content

ICE in handle_inline_attribute_on_fndecl, at rust/backend/rust-compile-base.cc:369 inline attr w param #3658

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
matthiaskrgr opened this issue Mar 30, 2025 · 0 comments · May be fixed by #3754

Comments

@matthiaskrgr
Copy link

auto-reduced (treereduce-rust):

//@compile-flags: -frust-incomplete-and-experimental-compiler-do-not-use
#[inline = ""]
fn main() {}

original:

#[inline = ""] //~ ERROR unexpected token: `!`
fn main() {}

Version information:

7651217

Possibly related line of code:

return;
}
const AST::AttrInput &input = attr.get_attr_input ();
bool is_token_tree
= input.get_attr_input_type () == AST::AttrInput::AttrInputType::TOKEN_TREE;
rust_assert (is_token_tree);
const auto &option = static_cast<const AST::DelimTokenTree &> (input);
AST::AttrInputMetaItemContainer *meta_item = option.parse_to_meta_item ();
if (meta_item->get_items ().size () != 1)
{
rich_location rich_locus (line_table, attr.get_locus ());
rich_locus.add_fixit_replace ("expected one argument");

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

Program output

crab1: internal compiler error: in handle_inline_attribute_on_fndecl, at rust/backend/rust-compile-base.cc:369
0x89bb51 Rust::Compile::HIRCompileBase::handle_inline_attribute_on_fndecl(tree_node*, Rust::AST::Attribute const&)
	../../gcc/rust/backend/rust-compile-base.cc:369
0x10a0e8b Rust::Compile::HIRCompileBase::setup_fndecl(tree_node*, bool, bool, Rust::HIR::Visibility&, Rust::HIR::FunctionQualifiers const&, std::vector<Rust::AST::Attribute, std::allocator<Rust::AST::Attribute> > const&)
	../../gcc/rust/backend/rust-compile-base.cc:101
0x10a16fd Rust::Compile::HIRCompileBase::compile_function(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Rust::HIR::SelfParam&, std::vector<Rust::HIR::FunctionParam, std::allocator<Rust::HIR::FunctionParam> >&, Rust::HIR::FunctionQualifiers const&, Rust::HIR::Visibility&, std::vector<Rust::AST::Attribute, std::allocator<Rust::AST::Attribute> >&, unsigned int, Rust::HIR::BlockExpr*, Rust::Resolver::CanonicalPath const&, Rust::TyTy::FnType*)
	../../gcc/rust/backend/rust-compile-base.cc:695
0x1068b2d Rust::Compile::CompileItem::visit(Rust::HIR::Function&)
	../../gcc/rust/backend/rust-compile-item.cc:256
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.

varun-r-mallya added a commit to varun-r-mallya/gccrs that referenced this issue Apr 17, 2025
I added a check to see if the attr_input_type was
a TOKEN_TREE and added an error message if a LITERAL is passed to it.

Fixes Rust-GCC#3658

gcc/rust/ChangeLog:

	* backend/rust-compile-base.cc: Handle LITERAL attribute input type.

Signed-off-by: varun-r-mallya <[email protected]>
varun-r-mallya added a commit to varun-r-mallya/gccrs that referenced this issue Apr 17, 2025
I added a check to see if the attr_input_type was
a TOKEN_TREE and added an error message if a LITERAL is passed to it.

Fixes Rust-GCC#3658

gcc/rust/ChangeLog:

	* backend/rust-compile-base.cc: Handle LITERAL attribute input type.

Signed-off-by: varun-r-mallya <[email protected]>
varun-r-mallya added a commit to varun-r-mallya/gccrs that referenced this issue Apr 17, 2025
I added a check to see if the attr_input_type was
a TOKEN_TREE and added an error message if a LITERAL is passed to it.

Fixes Rust-GCC#3658

gcc/rust/ChangeLog:

	* backend/rust-compile-base.cc (HIRCompileBase::handle_inline_attribute_on_fndecl):
	Handle LITERAL attribute input type.

Signed-off-by: varun-r-mallya <[email protected]>
varun-r-mallya added a commit to varun-r-mallya/gccrs that referenced this issue Apr 18, 2025
I added a check to see if the attr_input_type was
a TOKEN_TREE and added an error message if a LITERAL is passed to it.

Fixes Rust-GCC#3658

gcc/rust/ChangeLog:

	* backend/rust-compile-base.cc (HIRCompileBase::handle_inline_attribute_on_fndecl):
	Handle LITERAL attribute input type.

Signed-off-by: varun-r-mallya <[email protected]>
varun-r-mallya added a commit to varun-r-mallya/gccrs that referenced this issue Apr 18, 2025
I added a check to see if the attr_input_type was
a TOKEN_TREE and added an error message if a LITERAL is passed to it.

Fixes Rust-GCC#3658

gcc/rust/ChangeLog:

	* backend/rust-compile-base.cc (HIRCompileBase::handle_inline_attribute_on_fndecl):
	Handle LITERAL attribute input type.

gcc/testsuite/ChangeLog:

	* rust/compile/issue-3658.rs: New test.

Signed-off-by: varun-r-mallya <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants