-
Notifications
You must be signed in to change notification settings - Fork 170
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 binding richloc
to paser errors
#2566
Labels
Comments
what code did you try that caused the ICE exactly? |
I tried this code // #![feature(auto_traits)] // not present in Rust 1.49 yet
#![feature(optin_builtin_traits)]
unsafe auto trait Invalid { // { dg-error "associated items are forbidden within auto traits" }
fn foo(); // { dg-message "remove this item" }
fn bar() {} // { dg-message "remove this item" }
type Foo; // { dg-message "remove this item" }
const FOO: i32; // { dg-message "remove this item" }
const BAR: i32 = 15; // { dg-message "remove this item" }
}
// { dg-error "failed to parse item in crate" "" {target *-*-* } .+1 } Backtrace
➜ gccrs-build gcc/crab1 /home/mahad/Desktop/mahad/gccrs/gcc/testsuite/rust/compile/auto_trait_invalid.rs
The range is 1 // This line was printed by me, printf("\n The range is %d\n", richloc.get_num_locations ());
crab1: internal compiler error: in operator[], at libcpp/include/line-map.h:1438
0x22e242a semi_embedded_vec<location_range, 3>::operator[](int) const
../../gccrs/libcpp/include/line-map.h:1438
0x22e242a rich_location::get_range(unsigned int) const
../../gccrs/libcpp/line-map.cc:2154
0x22e242a rich_location::get_loc(unsigned int) const
../../gccrs/libcpp/line-map.cc:2145
0x12b418d diagnostic_location(diagnostic_info const*, int)
../../gccrs/gcc/diagnostic.h:555
0x12b418d diagnostic_report_current_function(diagnostic_context*, diagnostic_info*)
../../gccrs/gcc/tree-diagnostic.cc:40
0x12b41f4 default_tree_diagnostic_starter
../../gccrs/gcc/tree-diagnostic.cc:49
0x2289a13 diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*)
../../gccrs/gcc/diagnostic.cc:1593
0x228a18a diagnostic_impl
../../gccrs/gcc/diagnostic.cc:1756
0x228d16a error_meta(rich_location*, diagnostic_metadata const&, char const*, ...)
../../gccrs/gcc/diagnostic.cc:2108
0x9e1769 rust_be_error_at(rich_location*, ErrorCode, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
../../gccrs/gcc/rust/rust-diagnostics.cc:286
0x9e27ef rust_error_at(rich_location*, ErrorCode, char const*, ...)
../../gccrs/gcc/rust/rust-diagnostics.cc:296
0xac6bde Rust::Error::emit() const
../../gccrs/gcc/rust/rust-diagnostics.h:285
0xac6bde Rust::Parser<Rust::Lexer>::parse_crate()
../../gccrs/gcc/rust/parse/rust-parse-impl.h:448
0xac1e83 Rust::Session:with backtrace::compile_crate(char const*)
../../gccrs/gcwith backtrace:c/rust/rust-session-manager.cc:522
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.
And this code compiles successfully, instead of emitting error: If we use simple location instead of these, then it worked fine. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fixing this issue, improve this
rich-loc
&errorcode
in parser & expansion errors #2542I tried binding rich location to parser errors, but it emits ICE
This issue is becuase this
STATICALLY_ALLOCATED_RANGES
is set to3
gccrs/libcpp/include/line-map.h
Lines 1816 to 1820 in efa3041
And then it's break's on this
assertion
gccrs/libcpp/include/line-map.h
Lines 1434 to 1446 in efa3041
Due, to this assertion, it is difficult to bind
rich_location
with parser errors.Backtrace
Meta
This is the code, I experimented MahadMuhammad@9b911fd
The text was updated successfully, but these errors were encountered: