aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-04-13 11:10:17 -0400
committerAndrew Kelley <superjoe30@gmail.com>2018-04-13 11:10:17 -0400
commit1999f0daad505f414f97845ecde0a56b3c2fedfd (patch)
tree185598cde3a3f8b2320484e262899db5bc85b09e /src/main.cpp
parent0f652b4d80a57f5b5a1054d06cd5767ce52402a1 (diff)
downloadzig-1999f0daad505f414f97845ecde0a56b3c2fedfd.tar.gz
zig-1999f0daad505f414f97845ecde0a56b3c2fedfd.zip
fix undefined behavior triggered by fn inline test
LLVM destroys the string that we use to test if LLVM deleted the inlined function. Also fixed forgetting to initialize a buffer in std lib path detection.
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 63b077e833..37d1c91170 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -179,6 +179,7 @@ static int find_zig_lib_dir(Buf *out_path) {
Buf self_exe_path = BUF_INIT;
if (!(err = os_self_exe_path(&self_exe_path))) {
Buf *cur_path = &self_exe_path;
+ buf_resize(cur_path, 0);
for (;;) {
Buf *test_dir = buf_alloc();