diff options
author | Jon Chesterfield <jonathanchesterfield@gmail.com> | 2023-07-20 23:44:32 +0100 |
---|---|---|
committer | Jon Chesterfield <jonathanchesterfield@gmail.com> | 2023-07-20 23:44:33 +0100 |
commit | bf0992c7184407da420ced5bbfa9c718d0cf6d5b (patch) | |
tree | 0b47e5199fb17378cc119ea472152c06054b7971 /libc | |
parent | ca34f1bdcd38f778f00e4bedfebc5fde8b7302b3 (diff) | |
download | llvm-bf0992c7184407da420ced5bbfa9c718d0cf6d5b.zip llvm-bf0992c7184407da420ced5bbfa9c718d0cf6d5b.tar.gz llvm-bf0992c7184407da420ced5bbfa9c718d0cf6d5b.tar.bz2 |
[libc] Fix line reporting in assertion failure
Was passing zeros to the string print function.
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/D155899
Diffstat (limited to 'libc')
-rw-r--r-- | libc/src/__support/libc_assert.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libc/src/__support/libc_assert.h b/libc/src/__support/libc_assert.h index 64b03e5..549c5228 100644 --- a/libc/src/__support/libc_assert.h +++ b/libc/src/__support/libc_assert.h @@ -31,10 +31,11 @@ LIBC_INLINE void report_assertion_failure(const char *assertion, const char *filename, unsigned line, const char *funcname) { char line_str[IntegerToString::dec_bufsize<unsigned>()]; - IntegerToString::dec(line, line_str); + // dec returns an optional, will always be valid for this size buffer + auto line_number = IntegerToString::dec(line, line_str); __llvm_libc::write_to_stderr(filename); __llvm_libc::write_to_stderr(":"); - __llvm_libc::write_to_stderr(line_str); + __llvm_libc::write_to_stderr(*line_number); __llvm_libc::write_to_stderr(": Assertion failed: '"); __llvm_libc::write_to_stderr(assertion); __llvm_libc::write_to_stderr("' in function: '"); |