Skip to content
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

Variadic functions are unstable #2712

Closed
P-E-P opened this issue Oct 24, 2023 · 0 comments · Fixed by #2748
Closed

Variadic functions are unstable #2712

P-E-P opened this issue Oct 24, 2023 · 0 comments · Fixed by #2748
Assignees
Labels

Comments

@P-E-P
Copy link
Member

P-E-P commented Oct 24, 2023

Variadic functions are unstable and the compiler should emit an appropriate error.

I tried this code:

pub fn toto(a: i32, ...) {}

fn main() {}

I expected to see this happen:

error: only foreign or `unsafe extern "C"` functions may be C-variadic
 --> src/lib.rs:1:21
  |
1 | pub fn toto(a :i32, ...) {
  |                     ^^^

error[E0658]: C-variadic functions are unstable
 --> src/lib.rs:1:1
  |
1 | / pub fn toto(a :i32, ...) {
2 | |     
3 | | }
  | |_^
  |
  = note: see issue #44930 <https://github.com/rust-lang/rust/issues/44930> for more information

Instead, this happened:

ICE

Details

crab1: internal compiler error: in get_pattern, at rust/ast/rust-item.h:611
0x1235da6 Rust::AST::FunctionParam::get_pattern()
../../gcc/rust/ast/rust-item.h:611
0x131e6f0 Rust::CfgStrip::maybe_strip_function_params(std::vector<Rust::AST::FunctionParam, std::allocatorRust::AST::FunctionParam >&)
/home/patryp/Documents/gccrs/build/gcc/../../gcc/rust/expand/rust-cfg-strip.cc:236
0x1323344 Rust::CfgStrip::visit(Rust::AST::Function&)
/home/patryp/Documents/gccrs/build/gcc/../../gcc/rust/expand/rust-cfg-strip.cc:2081
0x113afa0 Rust::AST::Function::accept_vis(Rust::AST::ASTVisitor&)
/home/patryp/Documents/gccrs/build/gcc/../../gcc/rust/ast/rust-ast.cc:4757
0x131e342 Rust::CfgStrip::go(Rust::AST::Crate&)
/home/patryp/Documents/gccrs/build/gcc/../../gcc/rust/expand/rust-cfg-strip.cc:153
0x1265978 Rust::Session::expansion(Rust::AST::Crate&)
/home/patryp/Documents/gccrs/build/gcc/../../gcc/rust/rust-session-manager.cc:879
0x1264535 Rust::Session::compile_crate(char const*)
/home/patryp/Documents/gccrs/build/gcc/../../gcc/rust/rust-session-manager.cc:588
0x1263f84 Rust::Session::handle_input_files(int, char const**)
/home/patryp/Documents/gccrs/build/gcc/../../gcc/rust/rust-session-manager.cc:402
0x10d8172 grs_langhook_parse_file()
/home/patryp/Documents/gccrs/build/gcc/../../gcc/rust/rust-lang.cc:165
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.

Meta

@P-E-P P-E-P added the bug label Oct 24, 2023
@P-E-P P-E-P added this to the GCC 14.1 release milestone Oct 24, 2023
@P-E-P P-E-P self-assigned this Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant