diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-04-13 11:10:17 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-04-13 11:10:17 -0400 |
| commit | 1999f0daad505f414f97845ecde0a56b3c2fedfd (patch) | |
| tree | 185598cde3a3f8b2320484e262899db5bc85b09e /src/codegen.cpp | |
| parent | 0f652b4d80a57f5b5a1054d06cd5767ce52402a1 (diff) | |
| download | zig-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/codegen.cpp')
| -rw-r--r-- | src/codegen.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp index 2aca143524..a58832f983 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -467,7 +467,7 @@ static LLVMValueRef fn_llvm_value(CodeGen *g, FnTableEntry *fn_table_entry) { fn_table_entry->llvm_value, buf_ptr(&fn_export->name)); } } - fn_table_entry->llvm_name = LLVMGetValueName(fn_table_entry->llvm_value); + fn_table_entry->llvm_name = strdup(LLVMGetValueName(fn_table_entry->llvm_value)); switch (fn_table_entry->fn_inline) { case FnInlineAlways: |
