carbon-lang
carbon-lang copied to clipboard
explorer crashes on `var auto = i32;` construct
$ cat /tmp/crash.carbon package P api;
fn Main() -> i32 { var auto = i32; return 0; }
$ bazel run explorer:explorer /tmp/crash.carbon INFO: Invocation ID: 5382d45f-0f40-4517-b618-ae51e4db4d55 INFO: Analyzed target //explorer:explorer (0 packages loaded, 0 targets configured). INFO: Found 1 target... Target //explorer:explorer up-to-date: bazel-bin/explorer/explorer INFO: Elapsed time: 0.360s, Critical Path: 0.00s INFO: 1 process: 1 internal. INFO: Build completed successfully, 1 total action INFO: Build completed successfully, 1 total action /usr/local/google/home/pk19604014/.linuxbrew/Cellar/llvm/13.0.1_1/bin/../include/c++/v1/optional:911: _LIBCPP_ASSERT 'this->has_value()' failed. optional operator* called on a disengaged value Please report issues to https://github.com/carbon-language/carbon-lang/issues and include the crash backtrace. Stack dump: 0. Program arguments: /usr/local/google/home/pk19604014/.cache/bazel/_bazel_pk19604014/0c0c6d5ac7dde4460fd40f446af91e37/execroot/carbon/bazel-out/k8-fastbuild/bin/explorer/explorer /tmp/crash.carbon #0 0x0000564e337d245b backtrace /tmp/llvm-20220302-9880-1faggz0/llvm-project-13.0.1.src/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:4202:13 #1 0x0000564e33b0b56b llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /proc/self/cwd/external/llvm-project/llvm/lib/Support/Unix/Signals.inc:565:13 #2 0x0000564e33b0b80b PrintStackTraceSignalHandler(void*) /proc/self/cwd/external/llvm-project/llvm/lib/Support/Unix/Signals.inc:632:1 #3 0x0000564e33b05e68 llvm::sys::RunSignalHandlers() /proc/self/cwd/external/llvm-project/llvm/lib/Support/Signals.cpp:98:18 #4 0x0000564e33b0cdbe SignalHandler(int) /proc/self/cwd/external/llvm-project/llvm/lib/Support/Unix/Signals.inc:407:1 #5 0x00007f97e2b88200 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12200) #6 0x00007f97e28318a1 raise ./signal/../sysdeps/unix/sysv/linux/raise.c:50:1 #7 0x00007f97e281b546 abort ./stdlib/abort.c:81:7 #8 0x0000564e33c863cf (/usr/local/google/home/pk19604014/.cache/bazel/_bazel_pk19604014/0c0c6d5ac7dde4460fd40f446af91e37/execroot/carbon/bazel-out/k8-fastbuild/bin/explorer/explorer+0x9473cf) #9 0x0000564e33878d22 std::__1::optional<Carbon::Value const*>::operator*() const & /usr/local/google/home/pk19604014/.linuxbrew/Cellar/llvm/13.0.1_1/bin/../include/c++/v1/optional:911:9 #10 0x0000564e338a21dd Carbon::Pattern::value() const /proc/self/cwd/./explorer/ast/pattern.h:69:48 #11 0x0000564e339493be Carbon::Interpreter::StepStmt() /proc/self/cwd/explorer/interpreter/interpreter.cpp:0:55 #12 0x0000564e3394fd8f index /usr/local/google/home/pk19604014/.linuxbrew/Cellar/llvm/13.0.1_1/bin/../include/c++/v1/variant:788:12 #13 0x0000564e3394fd8f index /usr/local/google/home/pk19604014/.linuxbrew/Cellar/llvm/13.0.1_1/bin/../include/c++/v1/variant:1438:59 #14 0x0000564e3394fd8f __holds_alternative<1UL, Carbon::Error, Carbon::Success> /usr/local/google/home/pk19604014/.linuxbrew/Cellar/llvm/13.0.1_1/bin/../include/c++/v1/variant:1464:14 #15 0x0000564e3394fd8f holds_alternative<Carbon::Success, Carbon::Error, Carbon::Success> /usr/local/google/home/pk19604014/.linuxbrew/Cellar/llvm/13.0.1_1/bin/../include/c++/v1/variant:1470:10 #16 0x0000564e3394fd8f ok /proc/self/cwd/./common/error.h:61:36 #17 0x0000564e3394fd8f Carbon::Interpreter::Step() /proc/self/cwd/explorer/interpreter/interpreter.cpp:1428:7 #18 0x0000564e33950a65 Carbon::Interpreter::RunAllSteps(std::__1::unique_ptr<Carbon::Action, std::__1::default_deleteCarbon::Action >) /proc/self/cwd/explorer/interpreter/interpreter.cpp:0:5 #19 0x0000564e33951870 ~unique_ptr /usr/local/google/home/pk19604014/.linuxbrew/Cellar/llvm/13.0.1_1/bin/../include/c++/v1/__memory/unique_ptr.h:272:19 #20 0x0000564e33951870 Carbon::InterpProgram(Carbon::AST const&, Carbon::Arena*, std::__1::optionalllvm::raw_ostream*) /proc/self/cwd/explorer/interpreter/interpreter.cpp:1471:3 #21 0x0000564e3385a4a8 Carbon::ExecProgram(Carbon::Arena*, Carbon::AST, std::__1::optionalllvm::raw_ostream*) /proc/self/cwd/explorer/interpreter/exec_program.cpp:56:1 #22 0x0000564e3384c5c0 ~AST /proc/self/cwd/./explorer/ast/ast.h:17:8 #23 0x0000564e3384c5c0 Carbon::Main(llvm::StringRef, int, char**) /proc/self/cwd/explorer/main.cpp:78:3 #24 0x0000564e3384b5cc index /usr/local/google/home/pk19604014/.linuxbrew/Cellar/llvm/13.0.1_1/bin/../include/c++/v1/variant:788:12 #25 0x0000564e3384b5cc index /usr/local/google/home/pk19604014/.linuxbrew/Cellar/llvm/13.0.1_1/bin/../include/c++/v1/variant:1438:59 #26 0x0000564e3384b5cc __holds_alternative<1UL, Carbon::Error, Carbon::Success> /usr/local/google/home/pk19604014/.linuxbrew/Cellar/llvm/13.0.1_1/bin/../include/c++/v1/variant:1464:14 #27 0x0000564e3384b5cc holds_alternative<Carbon::Success, Carbon::Error, Carbon::Success> /usr/local/google/home/pk19604014/.linuxbrew/Cellar/llvm/13.0.1_1/bin/../include/c++/v1/variant:1470:10 #28 0x0000564e3384b5cc ok /proc/self/cwd/./common/error.h:61:36 #29 0x0000564e3384b5cc Carbon::ExplorerMain(llvm::StringRef, int, char**) /proc/self/cwd/explorer/main.cpp:88:69 #30 0x0000564e3384aa41 main /proc/self/cwd/explorer/main_bin.cpp:0:10 #31 0x00007f97e281c7fd __libc_start_main ./csu/../csu/libc-start.c:332:16 #32 0x0000564e3379983a _start (/usr/local/google/home/pk19604014/.cache/bazel/_bazel_pk19604014/0c0c6d5ac7dde4460fd40f446af91e37/execroot/carbon/bazel-out/k8-fastbuild/bin/explorer/explorer+0x45a83a)
package ExplorerTest api;
choice Ch { Alt(i32) }
fn Main() -> i32 { var Ch.Alt(1) = Ch.Alt(2); return 0; }
$ bazel run explorer:explorer
Crashes with ... CHECK failure at explorer/interpreter/interpreter.cpp:1300: PatternMatch(p, v, stmt.source_loc(), &matches, generic_args, trace_stream_, this->arena_): explorer/testdata/basic_syntax/fail_var_pattern.carbon:25: internal error in variable definition, match failed
var 1 = 2;
CHECK failure at explorer/interpreter/interpreter.cpp:1300: PatternMatch(p, v, stmt.source_loc(), &matches, generic_args, trace_stream_, this->arena_): explorer/testdata/basic_syntax/fail_var_pattern.carbon:26: internal error in variable definition, match failed
let var var x: auto = 1; currently compiles
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please comment or remove the inactive label. The long term label can also be added for issues which are expected to take time.
This issue is labeled inactive because the last activity was over 90 days ago.
Closing explorer-specific issues as not-planned for now due to our decision to prioritize working on the toolchain over other implementation work in the near term: https://github.com/carbon-language/carbon-lang/blob/trunk/proposals/p3532.md