You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It happened to be my fault on writing the code. Sorry for the inconvenience
Description of the bug:
When printing a variable auto typed, the explorer throws an error.
All the other Prints before the one in question were printed and after that the error was also printed.
What did you do, or what's a simple way to reproduce the bug?
The code I was writing for testing Carbon is this:
`package sandbox api;
fn OutputTextString() -> String { // creating other functions
return "Hello World from function that returns String";
}
fn OutputTextVoid() { // implicitly says to return void
var text_hello: String = "Hello World from variable"; // snake_case for variables
Print("Hello World from function that returns void");
Print(text_hello);
}
fn Main() -> i32 { // it could be MainFunction as an example of the convention for naming functions
Print("Hello World"); // P is capitalized because this is the pattern for functions in carbon
Print("{0}", 0); // this is how not String values are printed
Print(OutputTextString());
OutputTextVoid();
var simple_text: String = "Simple String";
simple_text = "Replacing simple String"; // var can be replaced
let const_text: String = "This is a const";
// const_text = "another value"; // it won't work because it's a const
var x: auto = 200;
// x = false; // it won't work because types are statics
Print("{x}", x);
return 0;
} Then run:$ bazel run //explorer -- ./exercise1.carbon`
What did you expect to happen?
I was expecting to print '200' as the last message.
What actually happened?
An explorer error message was printed.
Any other information, logs, or outputs that you want to share?
$ bazel run //explorer -- ./exercise1.carbon
INFO: Invocation ID: f1aa65c2-2d60-4560-966f-14ccbabfb9fd
WARNING: Download from https://mirror.bazel.build/ftp.gnu.org/gnu/m4/m4-1.4.18.tar.xz failed: class java.io.FileNotFoundException GET returned 404 Not Found
WARNING: Download from https://mirror.bazel.build/github.com/jmillikin/rules_m4/releases/download/v0.1/m4-gnulib-788db09a9f88abbef73c97e8d7291c40455336d8.tar.xz failed: class java.io.FileNotFoundException GET returned 404 Not Found
WARNING: Download from https://mirror.bazel.build/ftp.gnu.org/gnu/bison/bison-3.3.2.tar.xz failed: class java.io.FileNotFoundException GET returned 404 Not Found
WARNING: Download from https://mirror.bazel.build/github.com/jmillikin/rules_bison/releases/download/v0.1/bison-gnulib-788db09a9f88abbef73c97e8d7291c40455336d8.tar.xz failed: class java.io.FileNotFoundException GET returned 404 Not Found
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.081s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Build completed successfully, 1 total action
Hello World
0
Hello World from function that returns String
Hello World from function that returns void
Hello World from variable
explorer: external/llvm-project/llvm/lib/Support/FormatVariadic.cpp:70: static Optionalllvm::ReplacementItem llvm::formatv_object_base::parseReplacementItem(llvm::StringRef): Assertion `false && "Invalid replacement sequence index!"' failed.
Please report issues to https://github.com/carbon-language/carbon-lang/issues and include the crash backtrace.
Stack dump:
0. Program arguments: /home/fulvioleo/.cache/bazel/_bazel_fulvioleo/69b81af36d3a81c89120ad676b93f8c0/execroot/carbon/bazel-out/k8-fastbuild/bin/explorer/explorer ./exercise1.carbon
#0 0x000055e933bafedb backtrace /tmp/llvm-20221018-8379-ot76x/llvm-project-15.0.3.src/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:4410:13 #1 0x000055e933f84b8d llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /proc/self/cwd/external/llvm-project/llvm/lib/Support/Unix/Signals.inc:569:13 #2 0x000055e933f84e2b PrintStackTraceSignalHandler(void*) /proc/self/cwd/external/llvm-project/llvm/lib/Support/Unix/Signals.inc:636:1 #3 0x000055e933f7f7b3 llvm::sys::RunSignalHandlers() /proc/self/cwd/external/llvm-project/llvm/lib/Support/Signals.cpp:104:18 #4 0x000055e933f854b2 SignalHandler(int) /proc/self/cwd/external/llvm-project/llvm/lib/Support/Unix/Signals.inc:407:1 #5 0x00007f08ef928a70 __restore_rt (/lib64/libc.so.6+0x3ea70) #6 0x00007f08ef978c4c __pthread_kill_implementation (/lib64/libc.so.6+0x8ec4c) #7 0x00007f08ef9289c6 gsignal (/lib64/libc.so.6+0x3e9c6) #8 0x00007f08ef9127f4 abort (/lib64/libc.so.6+0x287f4) #9 0x00007f08ef91271b _nl_load_domain.cold (/lib64/libc.so.6+0x2871b) #10 0x00007f08ef921576 (/lib64/libc.so.6+0x37576) #11 0x000055e933f26260 llvm::formatv_object_base::parseReplacementItem(llvm::StringRef) /proc/self/cwd/external/llvm-project/llvm/lib/Support/FormatVariadic.cpp:70:5 #12 0x000055e933f26b98 llvm::formatv_object_base::splitLiteralAndReplacement(llvm::StringRef) /proc/self/cwd/external/llvm-project/llvm/lib/Support/FormatVariadic.cpp:0:15 #13 0x000055e933f27518 llvm::formatv_object_base::parseFormatString(llvm::StringRef) /proc/self/cwd/external/llvm-project/llvm/lib/Support/FormatVariadic.cpp:148:5 #14 0x000055e9340b6598 begin /proc/self/cwd/external/llvm-project/llvm/include/llvm/ADT/SmallVector.h:249:45 #15 0x000055e9340b6598 llvm::formatv_object_base::format(llvm::raw_ostream&) const /proc/self/cwd/external/llvm-project/llvm/include/llvm/Support/FormatVariadic.h:86:18 #16 0x000055e9340b6454 llvm::raw_ostream::operator<<(llvm::formatv_object_base const&) /proc/self/cwd/external/llvm-project/llvm/lib/Support/raw_ostream.cpp:350:3 #17 0x000055e933d9f0da Carbon::Interpreter::StepExp() /proc/self/cwd/explorer/interpreter/interpreter.cpp:0:28 #18 0x000055e933d8a518 index /home/linuxbrew/.linuxbrew/Cellar/llvm/15.0.3/bin/../include/c++/v1/variant:797:12 #19 0x000055e933d8a518 index /home/linuxbrew/.linuxbrew/Cellar/llvm/15.0.3/bin/../include/c++/v1/variant:1450:59 #20 0x000055e933d8a518 __holds_alternative<1UL, Carbon::Error, Carbon::Success> /home/linuxbrew/.linuxbrew/Cellar/llvm/15.0.3/bin/../include/c++/v1/variant:1476:14 #21 0x000055e933d8a518 holds_alternative<Carbon::Success, Carbon::Error, Carbon::Success> /home/linuxbrew/.linuxbrew/Cellar/llvm/15.0.3/bin/../include/c++/v1/variant:1482:10 #22 0x000055e933d8a518 ok /proc/self/cwd/./common/error.h:80:36 #23 0x000055e933d8a518 Carbon::Interpreter::Step() /proc/self/cwd/explorer/interpreter/interpreter.cpp:2052:7 #24 0x000055e933dbdaef index /home/linuxbrew/.linuxbrew/Cellar/llvm/15.0.3/bin/../include/c++/v1/variant:797:12 #25 0x000055e933dbdaef index /home/linuxbrew/.linuxbrew/Cellar/llvm/15.0.3/bin/../include/c++/v1/variant:1450:59 #26 0x000055e933dbdaef __holds_alternative<1UL, Carbon::Error, Carbon::Success> /home/linuxbrew/.linuxbrew/Cellar/llvm/15.0.3/bin/../include/c++/v1/variant:1476:14 #27 0x000055e933dbdaef holds_alternative<Carbon::Success, Carbon::Error, Carbon::Success> /home/linuxbrew/.linuxbrew/Cellar/llvm/15.0.3/bin/../include/c++/v1/variant:1482:10 #28 0x000055e933dbdaef ok /proc/self/cwd/./common/error.h:80:36 #29 0x000055e933dbdaef Carbon::Interpreter::RunAllSteps(std::__1::unique_ptr<Carbon::Action, std::__1::default_deleteCarbon::Action>) /proc/self/cwd/explorer/interpreter/interpreter.cpp:2084:5 #30 0x000055e933dbea2a reset /home/linuxbrew/.linuxbrew/Cellar/llvm/15.0.3/bin/../include/c++/v1/__memory/unique_ptr.h:302:28 #31 0x000055e933dbea2a ~unique_ptr /home/linuxbrew/.linuxbrew/Cellar/llvm/15.0.3/bin/../include/c++/v1/__memory/unique_ptr.h:259:19 #32 0x000055e933dbea2a Carbon::InterpProgram(Carbon::AST const&, Carbon::Arena*, std::__1::optionalllvm::raw_ostream*) /proc/self/cwd/explorer/interpreter/interpreter.cpp:2109:3 #33 0x000055e933c41cc2 Carbon::ExecProgram(Carbon::Arena*, Carbon::AST, std::__1::optionalllvm::raw_ostream*) /proc/self/cwd/explorer/interpreter/exec_program.cpp:67:3 #34 0x000055e933c363f3 Carbon::ExplorerMain(int, char**, void*, llvm::StringRef) /proc/self/cwd/explorer/main.cpp:108:34 #35 0x000055e933c349e7 main /proc/self/cwd/explorer/main_bin.cpp:12:3 #36 0x00007f08ef913550 __libc_start_call_main (/lib64/libc.so.6+0x29550) #37 0x00007f08ef913609 __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x29609) #38 0x000055e933b726f5 _start (/home/fulvioleo/.cache/bazel/_bazel_fulvioleo/69b81af36d3a81c89120ad676b93f8c0/execroot/carbon/bazel-out/k8-fastbuild/bin/explorer/explorer+0x4db6f5)
The text was updated successfully, but these errors were encountered:
The remaining issue here is the stack trace, but AFAIK formatv doesn't provide a way to validate the format argument. Lacking that, I think it's best to defer to a rewrite (#1801)
It happened to be my fault on writing the code. Sorry for the inconvenience
Description of the bug:
When printing a variable auto typed, the explorer throws an error.
All the other Prints before the one in question were printed and after that the error was also printed.
What did you do, or what's a simple way to reproduce the bug?
The code I was writing for testing Carbon is this:
`package sandbox api;
fn OutputTextString() -> String { // creating other functions
return "Hello World from function that returns String";
}
fn OutputTextVoid() { // implicitly says to return void
var text_hello: String = "Hello World from variable"; // snake_case for variables
Print("Hello World from function that returns void");
Print(text_hello);
}
fn Main() -> i32 { // it could be MainFunction as an example of the convention for naming functions
Print("Hello World"); // P is capitalized because this is the pattern for functions in carbon
Print("{0}", 0); // this is how not String values are printed
Print(OutputTextString());
OutputTextVoid();
var simple_text: String = "Simple String";
simple_text = "Replacing simple String"; // var can be replaced
let const_text: String = "This is a const";
// const_text = "another value"; // it won't work because it's a const
var x: auto = 200;
// x = false; // it won't work because types are statics
Print("{x}", x);
return 0;
}
Then run:
$ bazel run //explorer -- ./exercise1.carbon`What did you expect to happen?
I was expecting to print '200' as the last message.
What actually happened?
An explorer error message was printed.
Any other information, logs, or outputs that you want to share?
$ bazel run //explorer -- ./exercise1.carbon
INFO: Invocation ID: f1aa65c2-2d60-4560-966f-14ccbabfb9fd
WARNING: Download from https://mirror.bazel.build/ftp.gnu.org/gnu/m4/m4-1.4.18.tar.xz failed: class java.io.FileNotFoundException GET returned 404 Not Found
WARNING: Download from https://mirror.bazel.build/github.com/jmillikin/rules_m4/releases/download/v0.1/m4-gnulib-788db09a9f88abbef73c97e8d7291c40455336d8.tar.xz failed: class java.io.FileNotFoundException GET returned 404 Not Found
WARNING: Download from https://mirror.bazel.build/ftp.gnu.org/gnu/bison/bison-3.3.2.tar.xz failed: class java.io.FileNotFoundException GET returned 404 Not Found
WARNING: Download from https://mirror.bazel.build/github.com/jmillikin/rules_bison/releases/download/v0.1/bison-gnulib-788db09a9f88abbef73c97e8d7291c40455336d8.tar.xz failed: class java.io.FileNotFoundException GET returned 404 Not Found
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.081s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Build completed successfully, 1 total action
Hello World
0
Hello World from function that returns String
Hello World from function that returns void
Hello World from variable
explorer: external/llvm-project/llvm/lib/Support/FormatVariadic.cpp:70: static Optionalllvm::ReplacementItem llvm::formatv_object_base::parseReplacementItem(llvm::StringRef): Assertion `false && "Invalid replacement sequence index!"' failed.
Please report issues to https://github.com/carbon-language/carbon-lang/issues and include the crash backtrace.
Stack dump:
0. Program arguments: /home/fulvioleo/.cache/bazel/_bazel_fulvioleo/69b81af36d3a81c89120ad676b93f8c0/execroot/carbon/bazel-out/k8-fastbuild/bin/explorer/explorer ./exercise1.carbon
#0 0x000055e933bafedb backtrace /tmp/llvm-20221018-8379-ot76x/llvm-project-15.0.3.src/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:4410:13
#1 0x000055e933f84b8d llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /proc/self/cwd/external/llvm-project/llvm/lib/Support/Unix/Signals.inc:569:13
#2 0x000055e933f84e2b PrintStackTraceSignalHandler(void*) /proc/self/cwd/external/llvm-project/llvm/lib/Support/Unix/Signals.inc:636:1
#3 0x000055e933f7f7b3 llvm::sys::RunSignalHandlers() /proc/self/cwd/external/llvm-project/llvm/lib/Support/Signals.cpp:104:18
#4 0x000055e933f854b2 SignalHandler(int) /proc/self/cwd/external/llvm-project/llvm/lib/Support/Unix/Signals.inc:407:1
#5 0x00007f08ef928a70 __restore_rt (/lib64/libc.so.6+0x3ea70)
#6 0x00007f08ef978c4c __pthread_kill_implementation (/lib64/libc.so.6+0x8ec4c)
#7 0x00007f08ef9289c6 gsignal (/lib64/libc.so.6+0x3e9c6)
#8 0x00007f08ef9127f4 abort (/lib64/libc.so.6+0x287f4)
#9 0x00007f08ef91271b _nl_load_domain.cold (/lib64/libc.so.6+0x2871b)
#10 0x00007f08ef921576 (/lib64/libc.so.6+0x37576)
#11 0x000055e933f26260 llvm::formatv_object_base::parseReplacementItem(llvm::StringRef) /proc/self/cwd/external/llvm-project/llvm/lib/Support/FormatVariadic.cpp:70:5
#12 0x000055e933f26b98 llvm::formatv_object_base::splitLiteralAndReplacement(llvm::StringRef) /proc/self/cwd/external/llvm-project/llvm/lib/Support/FormatVariadic.cpp:0:15
#13 0x000055e933f27518 llvm::formatv_object_base::parseFormatString(llvm::StringRef) /proc/self/cwd/external/llvm-project/llvm/lib/Support/FormatVariadic.cpp:148:5
#14 0x000055e9340b6598 begin /proc/self/cwd/external/llvm-project/llvm/include/llvm/ADT/SmallVector.h:249:45
#15 0x000055e9340b6598 llvm::formatv_object_base::format(llvm::raw_ostream&) const /proc/self/cwd/external/llvm-project/llvm/include/llvm/Support/FormatVariadic.h:86:18
#16 0x000055e9340b6454 llvm::raw_ostream::operator<<(llvm::formatv_object_base const&) /proc/self/cwd/external/llvm-project/llvm/lib/Support/raw_ostream.cpp:350:3
#17 0x000055e933d9f0da Carbon::Interpreter::StepExp() /proc/self/cwd/explorer/interpreter/interpreter.cpp:0:28
#18 0x000055e933d8a518 index /home/linuxbrew/.linuxbrew/Cellar/llvm/15.0.3/bin/../include/c++/v1/variant:797:12
#19 0x000055e933d8a518 index /home/linuxbrew/.linuxbrew/Cellar/llvm/15.0.3/bin/../include/c++/v1/variant:1450:59
#20 0x000055e933d8a518 __holds_alternative<1UL, Carbon::Error, Carbon::Success> /home/linuxbrew/.linuxbrew/Cellar/llvm/15.0.3/bin/../include/c++/v1/variant:1476:14
#21 0x000055e933d8a518 holds_alternative<Carbon::Success, Carbon::Error, Carbon::Success> /home/linuxbrew/.linuxbrew/Cellar/llvm/15.0.3/bin/../include/c++/v1/variant:1482:10
#22 0x000055e933d8a518 ok /proc/self/cwd/./common/error.h:80:36
#23 0x000055e933d8a518 Carbon::Interpreter::Step() /proc/self/cwd/explorer/interpreter/interpreter.cpp:2052:7
#24 0x000055e933dbdaef index /home/linuxbrew/.linuxbrew/Cellar/llvm/15.0.3/bin/../include/c++/v1/variant:797:12
#25 0x000055e933dbdaef index /home/linuxbrew/.linuxbrew/Cellar/llvm/15.0.3/bin/../include/c++/v1/variant:1450:59
#26 0x000055e933dbdaef __holds_alternative<1UL, Carbon::Error, Carbon::Success> /home/linuxbrew/.linuxbrew/Cellar/llvm/15.0.3/bin/../include/c++/v1/variant:1476:14
#27 0x000055e933dbdaef holds_alternative<Carbon::Success, Carbon::Error, Carbon::Success> /home/linuxbrew/.linuxbrew/Cellar/llvm/15.0.3/bin/../include/c++/v1/variant:1482:10
#28 0x000055e933dbdaef ok /proc/self/cwd/./common/error.h:80:36
#29 0x000055e933dbdaef Carbon::Interpreter::RunAllSteps(std::__1::unique_ptr<Carbon::Action, std::__1::default_deleteCarbon::Action>) /proc/self/cwd/explorer/interpreter/interpreter.cpp:2084:5
#30 0x000055e933dbea2a reset /home/linuxbrew/.linuxbrew/Cellar/llvm/15.0.3/bin/../include/c++/v1/__memory/unique_ptr.h:302:28
#31 0x000055e933dbea2a ~unique_ptr /home/linuxbrew/.linuxbrew/Cellar/llvm/15.0.3/bin/../include/c++/v1/__memory/unique_ptr.h:259:19
#32 0x000055e933dbea2a Carbon::InterpProgram(Carbon::AST const&, Carbon::Arena*, std::__1::optionalllvm::raw_ostream*) /proc/self/cwd/explorer/interpreter/interpreter.cpp:2109:3
#33 0x000055e933c41cc2 Carbon::ExecProgram(Carbon::Arena*, Carbon::AST, std::__1::optionalllvm::raw_ostream*) /proc/self/cwd/explorer/interpreter/exec_program.cpp:67:3
#34 0x000055e933c363f3 Carbon::ExplorerMain(int, char**, void*, llvm::StringRef) /proc/self/cwd/explorer/main.cpp:108:34
#35 0x000055e933c349e7 main /proc/self/cwd/explorer/main_bin.cpp:12:3
#36 0x00007f08ef913550 __libc_start_call_main (/lib64/libc.so.6+0x29550)
#37 0x00007f08ef913609 __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x29609)
#38 0x000055e933b726f5 _start (/home/fulvioleo/.cache/bazel/_bazel_fulvioleo/69b81af36d3a81c89120ad676b93f8c0/execroot/carbon/bazel-out/k8-fastbuild/bin/explorer/explorer+0x4db6f5)
The text was updated successfully, but these errors were encountered: