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

ICE when input file name is a directory ending with slash #3129

Open
tamaroning opened this issue Aug 12, 2024 · 3 comments · May be fixed by #3146
Open

ICE when input file name is a directory ending with slash #3129

tamaroning opened this issue Aug 12, 2024 · 3 comments · May be fixed by #3146

Comments

@tamaroning
Copy link
Contributor

tamaroning commented Aug 12, 2024

$ mkdir dir
$ ./crab1 -frust-incomplete-and-experimental-compiler-do-not-use dir/
crab1: internal compiler error: in set_crate_name, at rust/rust-session-manager.h:290
0x164c327 Rust::CompileOptions::set_crate_name(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)
        ../../gccrs/gcc/rust/rust-session-manager.h:290
0x1647e8a Rust::Session::handle_input_files(int, char const**)
        ../../gccrs/gcc/rust/rust-session-manager.cc:409
0x14a795e grs_langhook_parse_file
        ../../gccrs/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.

expected output:

crab1: error: cannot open filename dir: Is a directory
Backtrace

0x164c327 Rust::CompileOptions::set_crate_name(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)
      ../../gccrs/gcc/rust/rust-session-manager.h:290
0x1647e8a Rust::Session::handle_input_files(int, char const**)
      ../../gccrs/gcc/rust/rust-session-manager.cc:409
0x14a795e grs_langhook_parse_file
      ../../gccrs/gcc/rust/rust-lang.cc:165

I am using Ubuntu 22.0.4 on WSL2

@tamaroning tamaroning added the bug label Aug 12, 2024
dylngg added a commit to dylngg/gccrs that referenced this issue Aug 29, 2024
Fixes Rust-GCC#3129.

gcc/rust/ChangeLog:

	* rust-session-manager.cc (Session::handle_crate_name): Remove
	crate name inference
	(Session::compile_crate): Add crate name inference and error if
	inferred name is empty. Remove CompileOptions::get_instance ()
	that returned a local copy of the options. Rename
	crate_name_changed to crate_name_found to match semantics.
	(rust_crate_name_validation_test): Test inferring ".rs" name
	* rust-session-manager.h: Modify handle_crate_name definition to
	include filename.
@dylngg dylngg linked a pull request Aug 29, 2024 that will close this issue
dylngg added a commit to dylngg/gccrs that referenced this issue Aug 29, 2024
Fixes Rust-GCC#3129.

gcc/rust/ChangeLog:

	* rust-session-manager.cc (Session::handle_crate_name): Remove
	crate name inference
	(Session::compile_crate): Add crate name inference and error if
	inferred name is empty. Remove CompileOptions::get_instance ()
	that returned a local copy of the options. Rename
	crate_name_changed to crate_name_found to match semantics.
	(rust_crate_name_validation_test): Test inferring ".rs" name
	* rust-session-manager.h: Modify handle_crate_name definition to
	include filename.
dylngg added a commit to dylngg/gccrs that referenced this issue Aug 29, 2024
Fixes Rust-GCC#3129.

gcc/rust/ChangeLog:

	* rust-session-manager.cc (Session::handle_crate_name): Remove
	crate name inference
	(Session::compile_crate): Add crate name inference and error if
	inferred name is empty. Remove CompileOptions::get_instance ()
	that returned a local copy of the options. Rename
	crate_name_changed to crate_name_found to match semantics.
	(rust_crate_name_validation_test): Test inferring ".rs" name
	* rust-session-manager.h: Modify handle_crate_name definition to
	include filename.
@yomanthunder
Copy link

Hello, Is anyone currently working on this issue? I want to work on this issue.

@tamaroning
Copy link
Contributor Author

Hi @yomanthunder
PR #3146, which is linked to this issue, is currently ready to be merged.

You can take a look at another issue labeled as good-first-pr. (It seems that no one is working on #2872)

@yomanthunder
Copy link

Thanks for the update, @tamaroning! I’ll look into issue #2872.

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.

3 participants