[compiler-rt] 7cc6d0c - [TSAN] Fix infinite loop on targets where char is unsigned
Nemanja Ivanovic via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 11 05:13:10 PDT 2020
Author: Nemanja Ivanovic
Date: 2020-04-11T07:12:47-05:00
New Revision: 7cc6d0cc90e24a00a6eefd762cac160c795fc420
URL: https://github.com/llvm/llvm-project/commit/7cc6d0cc90e24a00a6eefd762cac160c795fc420
DIFF: https://github.com/llvm/llvm-project/commit/7cc6d0cc90e24a00a6eefd762cac160c795fc420.diff
LOG: [TSAN] Fix infinite loop on targets where char is unsigned
For targets where char is unsigned (like PowerPC), something like
char c = fgetc(...) will never produce a char that will compare
equal to EOF so this loop does not terminate.
Change the type to int (which appears to be the POSIX return type
for fgetc).
This allows the test case to terminate normally on PPC.
Added:
Modified:
compiler-rt/test/tsan/fiber_cleanup.cpp
Removed:
################################################################################
diff --git a/compiler-rt/test/tsan/fiber_cleanup.cpp b/compiler-rt/test/tsan/fiber_cleanup.cpp
index 6c226ad692bd..494830e4385f 100644
--- a/compiler-rt/test/tsan/fiber_cleanup.cpp
+++ b/compiler-rt/test/tsan/fiber_cleanup.cpp
@@ -13,7 +13,7 @@ long count_memory_mappings() {
FILE *proc_file = fopen(proc_file_name, "r");
long line_count = 0;
- char c;
+ int c;
do {
c = fgetc(proc_file);
if (c == '\n') {
More information about the llvm-commits
mailing list