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

explorer crashes on the 'match ... case auto {}' construct #1271

Closed
pk19604014 opened this issue May 17, 2022 · 1 comment
Closed

explorer crashes on the 'match ... case auto {}' construct #1271

pk19604014 opened this issue May 17, 2022 · 1 comment
Assignees

Comments

@pk19604014
Copy link
Contributor

pk19604014 commented May 17, 2022

$ cat /tmp/crash.carbon 
package P api;

choice Ch { Alt() }

fn Main() -> i32 {
  match (Ch.Alt()) { case auto => { return 1; } }
  return 0;
}

$ bazel run --config=proto-fuzzer explorer:explorer /tmp/crash.carbon
INFO: Invocation ID: b0a75d0e-1ab7-4702-b8ae-c3ec41c5de93
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.110s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Build completed successfully, 1 total action
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 0x00005627c3635f3b 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 0x00005627c3927ddb llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /proc/self/cwd/external/llvm-project/llvm/lib/Support/Unix/Signals.inc:565:13
 #2 0x00005627c392807b PrintStackTraceSignalHandler(void*) /proc/self/cwd/external/llvm-project/llvm/lib/Support/Unix/Signals.inc:632:1
 #3 0x00005627c3922ab8 llvm::sys::RunSignalHandlers() /proc/self/cwd/external/llvm-project/llvm/lib/Support/Signals.cpp:98:18
 #4 0x00005627c392962e SignalHandler(int) /proc/self/cwd/external/llvm-project/llvm/lib/Support/Unix/Signals.inc:407:1
 #5 0x00007f49dffe9200 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12200)
 #6 0x00005627c377286a kind /proc/self/cwd/./explorer/interpreter/value.h:97:38
 #7 0x00005627c377286a Carbon::PatternMatch(Carbon::Value const*, Carbon::Value const*, Carbon::SourceLocation, std::__1::optional<Carbon::RuntimeScope*>, std::__1::map<Carbon::GenericBinding const*, Carbon::Value const*, std::__1::less<Carbon::GenericBinding const*>, std::__1::allocator<std::__1::pair<Carbon::GenericBinding const* const, Carbon::Value const*> > >&, std::__1::optional<llvm::raw_ostream*>) /proc/self/cwd/explorer/interpreter/interpreter.cpp:217:14
 #8 0x00005627c379204d Carbon::Interpreter::StepStmt() /proc/self/cwd/explorer/interpreter/interpreter.cpp:1166:13
 #9 0x00005627c3797e77 index /usr/local/google/home/pk19604014/.linuxbrew/Cellar/llvm/13.0.1_1/bin/../include/c++/v1/variant:788:12
#10 0x00005627c3797e77 index /usr/local/google/home/pk19604014/.linuxbrew/Cellar/llvm/13.0.1_1/bin/../include/c++/v1/variant:1438:59
#11 0x00005627c3797e77 __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
#12 0x00005627c3797e77 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
#13 0x00005627c3797e77 ok /proc/self/cwd/./common/error.h:61:36
#14 0x00005627c3797e77 Carbon::Interpreter::Step() /proc/self/cwd/explorer/interpreter/interpreter.cpp:1410:7
#15 0x00005627c3798d28 Carbon::Interpreter::RunAllSteps(std::__1::unique_ptr<Carbon::Action, std::__1::default_delete<Carbon::Action> >) /proc/self/cwd/explorer/interpreter/interpreter.cpp:0:5
#16 0x00005627c3799955 ~unique_ptr /usr/local/google/home/pk19604014/.linuxbrew/Cellar/llvm/13.0.1_1/bin/../include/c++/v1/__memory/unique_ptr.h:272:19
#17 0x00005627c3799955 Carbon::InterpProgram(Carbon::AST const&, Carbon::Arena*, std::__1::optional<llvm::raw_ostream*>) /proc/self/cwd/explorer/interpreter/interpreter.cpp:1453:3
#18 0x00005627c36ba063 Carbon::ExecProgram(Carbon::Arena*, Carbon::AST, std::__1::optional<llvm::raw_ostream*>) /proc/self/cwd/explorer/interpreter/exec_program.cpp:0:10
#19 0x00005627c36b0215 Carbon::Main(llvm::StringRef, int, char**) /proc/self/cwd/explorer/main.cpp:78:3
#20 0x00005627c36af0dc index /usr/local/google/home/pk19604014/.linuxbrew/Cellar/llvm/13.0.1_1/bin/../include/c++/v1/variant:788:12
#21 0x00005627c36af0dc index /usr/local/google/home/pk19604014/.linuxbrew/Cellar/llvm/13.0.1_1/bin/../include/c++/v1/variant:1438:59
#22 0x00005627c36af0dc __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
#23 0x00005627c36af0dc 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
#24 0x00005627c36af0dc ok /proc/self/cwd/./common/error.h:61:36
#25 0x00005627c36af0dc Carbon::ExplorerMain(llvm::StringRef, int, char**) /proc/self/cwd/explorer/main.cpp:88:69
#26 0x00005627c36ae5a5 main /proc/self/cwd/explorer/main_bin.cpp:0:10
#27 0x00007f49dfc7d7fd __libc_start_main ./csu/../csu/libc-start.c:332:16
#28 0x00005627c35fd31a _start (/usr/local/google/home/pk19604014/.cache/bazel/_bazel_pk19604014/0c0c6d5ac7dde4460fd40f446af91e37/execroot/carbon/bazel-out/k8-fastbuild/bin/explorer/explorer+0x3cf31a)
AddressSanitizer:DEADLYSIGNAL
=================================================================
==707017==ERROR: AddressSanitizer: SEGV on unknown address (pc 0x5627c377286a bp 0x7fff049f4520 sp 0x7fff049f4080 T0)
==707017==The signal is caused by a READ memory access.
==707017==Hint: this fault was caused by a dereference of a high value address (see register values below).  Disassemble the provided pc to learn which register was used.
    #0 0x5627c377286a in kind /proc/self/cwd/./explorer/interpreter/value.h:97:38
    #1 0x5627c377286a in Carbon::PatternMatch(Carbon::Value const*, Carbon::Value const*, Carbon::SourceLocation, std::__1::optional<Carbon::RuntimeScope*>, std::__1::map<Carbon::GenericBinding const*, Carbon::Value const*, std::__1::less<Carbon::GenericBinding const*>, std::__1::allocator<std::__1::pair<Carbon::GenericBinding const* const, Carbon::Value const*> > >&, std::__1::optional<llvm::raw_ostream*>) /proc/self/cwd/explorer/interpreter/interpreter.cpp:217:14
    #2 0x5627c379204c in Carbon::Interpreter::StepStmt() /proc/self/cwd/explorer/interpreter/interpreter.cpp:1166:13
    #3 0x5627c3797e76 in Carbon::Interpreter::Step() /proc/self/cwd/explorer/interpreter/interpreter.cpp:1410:7
    #4 0x5627c3798d27 in Carbon::Interpreter::RunAllSteps(std::__1::unique_ptr<Carbon::Action, std::__1::default_delete<Carbon::Action> >) /proc/self/cwd/explorer/interpreter/interpreter.cpp:1428:5
    #5 0x5627c3799954 in Carbon::InterpProgram(Carbon::AST const&, Carbon::Arena*, std::__1::optional<llvm::raw_ostream*>) /proc/self/cwd/explorer/interpreter/interpreter.cpp:1453:3
    #6 0x5627c36ba062 in Carbon::ExecProgram(Carbon::Arena*, Carbon::AST, std::__1::optional<llvm::raw_ostream*>) /proc/self/cwd/explorer/interpreter/exec_program.cpp:55:10
    #7 0x5627c36b0214 in Carbon::Main(llvm::StringRef, int, char**) /proc/self/cwd/explorer/main.cpp:78:3
    #8 0x5627c36af0db in Carbon::ExplorerMain(llvm::StringRef, int, char**) /proc/self/cwd/explorer/main.cpp:88:21
    #9 0x5627c36ae5a4 in main /proc/self/cwd/explorer/main_bin.cpp:29:10
    #10 0x7f49dfc7d7fc in __libc_start_main csu/../csu/libc-start.c:332:16
    #11 0x5627c35fd319 in _start (/usr/local/google/home/pk19604014/.cache/bazel/_bazel_pk19604014/0c0c6d5ac7dde4460fd40f446af91e37/execroot/carbon/bazel-out/k8-fastbuild/bin/explorer/explorer+0x3cf319)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /proc/self/cwd/./explorer/interpreter/value.h:97:38 in kind
==707017==ABORTING
@pk19604014 pk19604014 self-assigned this May 17, 2022
@pk19604014
Copy link
Contributor Author

Now getting this error when running on trunk:

COMPILATION ERROR: /tmp/crash.carbon:6: type error in match expression: 'choice Ch' is not implicitly convertible to 'Type'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant