summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/emscripten-optimizer/simple_ast.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/emscripten-optimizer/simple_ast.h b/src/emscripten-optimizer/simple_ast.h
index 70ecb2acd..7644daac3 100644
--- a/src/emscripten-optimizer/simple_ast.h
+++ b/src/emscripten-optimizer/simple_ast.h
@@ -947,17 +947,19 @@ struct JSPrinter {
bool integer = wasm::isInteger(d);
#define BUFFERSIZE 1000
// f is normal, e is scientific for float, x for integer
- static char full_storage_f[BUFFERSIZE], full_storage_e[BUFFERSIZE];
+ // These need to be thread-local because they are returned.
+ thread_local char full_storage_f[BUFFERSIZE];
+ thread_local char full_storage_e[BUFFERSIZE];
// full has one more char, for a possible '-'
- static char *storage_f = full_storage_f + 1,
- *storage_e = full_storage_e + 1;
+ char* storage_f = full_storage_f + 1;
+ char* storage_e = full_storage_e + 1;
auto err_f = std::numeric_limits<double>::quiet_NaN();
auto err_e = std::numeric_limits<double>::quiet_NaN();
for (int e = 0; e <= 1; e++) {
char* buffer = e ? storage_e : storage_f;
double temp;
if (!integer) {
- static char format[6];
+ char format[6];
for (int i = 0; i <= 18; i++) {
format[0] = '%';
format[1] = '.';