Skip to content

Commit 2582123

Browse files
committed
Fix LTO runs of test_nothrow_new_nogrow
This test was recently added in emscripten-core#20154 but has been failing on the emscripten-releases waterfall in thinlto modes. I'm not sure exactly why, but it seems that perhaps when the value of `data` is not actually thinLTO simple removes the call the new/malloc? I'm not sure why this wasn't also failing under full LTO.
1 parent 1becb5a commit 2582123

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

test/core/test_nothrow_new.cpp

+7-11
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,14 @@
33
// University of Illinois/NCSA Open Source License. Both these licenses can be
44
// found in the LICENSE file.
55

6-
#include <iostream>
6+
#include <cassert>
7+
#include <cstdio>
78
#include <new>
89

9-
char* data;
10-
1110
int main() {
12-
data = new (std::nothrow) char[20 * 1024 * 1024];
13-
if (data == nullptr) {
14-
std::cout << "success" << std::endl;
15-
return 0;
16-
} else {
17-
std::cout << "failure" << std::endl;
18-
return 1;
19-
}
11+
char* data = new (std::nothrow) char[20 * 1024 * 1024];
12+
printf("data: %p\n", data);
13+
assert(data == nullptr);
14+
printf("success\n");
15+
return 0;
2016
}

test/core/test_nothrow_new.out

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
data: 0
12
success

0 commit comments

Comments
 (0)