[compiler-rt] 10aa0d7 - [compiler-rt] Fix compiler warnings and runtime errors in sanitizer RT strxfrm(_l) test cases.
Matt Morehouse via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 13 15:36:35 PDT 2020
Author: Dokyung Song
Date: 2020-07-13T22:35:01Z
New Revision: 10aa0d7bbc12bf86958bc40943e37b46c6eed04a
URL: https://github.com/llvm/llvm-project/commit/10aa0d7bbc12bf86958bc40943e37b46c6eed04a
DIFF: https://github.com/llvm/llvm-project/commit/10aa0d7bbc12bf86958bc40943e37b46c6eed04a.diff
LOG: [compiler-rt] Fix compiler warnings and runtime errors in sanitizer RT strxfrm(_l) test cases.
Summary: Fixed an implicit definition warning by including <string.h>. Also fixed run-time assertions that the return value of strxfrm_l calls is less than the buffer size by increasing the size of the referenced buffer.
Reviewers: morehouse
Reviewed By: morehouse
Subscribers: dberris, #sanitizers
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D83593
Added:
Modified:
compiler-rt/test/msan/__strxfrm_l.cpp
compiler-rt/test/sanitizer_common/TestCases/Posix/strxfrm.c
Removed:
################################################################################
diff --git a/compiler-rt/test/msan/__strxfrm_l.cpp b/compiler-rt/test/msan/__strxfrm_l.cpp
index c4eb10efb3e0..9766d3305685 100644
--- a/compiler-rt/test/msan/__strxfrm_l.cpp
+++ b/compiler-rt/test/msan/__strxfrm_l.cpp
@@ -10,7 +10,7 @@
extern "C" decltype(strxfrm_l) __strxfrm_l;
int main(void) {
- char q[10];
+ char q[100];
locale_t loc = newlocale(LC_ALL_MASK, "", (locale_t)0);
size_t n = __strxfrm_l(q, "qwerty", sizeof(q), loc);
assert(n < sizeof(q));
diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/strxfrm.c b/compiler-rt/test/sanitizer_common/TestCases/Posix/strxfrm.c
index c28eb65b7d4f..d08af1b3565f 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/Posix/strxfrm.c
+++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/strxfrm.c
@@ -3,16 +3,16 @@
#include <assert.h>
#include <locale.h>
-#include <wchar.h>
+#include <string.h>
int main(int argc, char **argv) {
char q[10];
size_t n = strxfrm(q, "abcdef", sizeof(q));
assert(n < sizeof(q));
- char q2[10];
+ char q2[100];
locale_t loc = newlocale(LC_ALL_MASK, "", (locale_t)0);
- n = strxfrm_l(q2, L"qwerty", sizeof(q), loc);
+ n = strxfrm_l(q2, "qwerty", sizeof(q2), loc);
assert(n < sizeof(q2));
freelocale(loc);
More information about the llvm-commits
mailing list