Skip to content

Commit 30cc677

Browse files
committed
mmap
Created using spr 1.3.4
2 parents 5ec3379 + ed7868d commit 30cc677

File tree

4 files changed

+23
-16
lines changed

4 files changed

+23
-16
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,7 @@ bool IsAccessibleMemoryRange(uptr beg, uptr size) {
302302
// `read` from `fds[0]` into a dummy buffer to free up the pipe buffer for
303303
// more `write` is slower than just recreating a pipe.
304304
int fds[2];
305-
if (pipe(fds))
306-
return false;
305+
CHECK_EQ(0, pipe(fds));
307306

308307
auto cleanup = at_scope_exit([&]() {
309308
internal_close(fds[0]);

compiler-rt/lib/sanitizer_common/tests/sanitizer_posix_test.cpp

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ TEST(SanitizerCommon, PthreadDestructorIterations) {
6565

6666
TEST(SanitizerCommon, IsAccessibleMemoryRange) {
6767
const int page_size = GetPageSize();
68-
uptr mem = (uptr)mmap(0, 3 * page_size, PROT_READ | PROT_WRITE,
69-
MAP_PRIVATE | MAP_ANON, -1, 0);
68+
InternalMmapVector<char> buffer(3 * page_size);
69+
uptr mem = reinterpret_cast<uptr>(buffer.data());
7070
// Protect the middle page.
7171
mprotect((void *)(mem + page_size), page_size, PROT_NONE);
7272
EXPECT_TRUE(IsAccessibleMemoryRange(mem, page_size - 1));
@@ -78,19 +78,12 @@ TEST(SanitizerCommon, IsAccessibleMemoryRange) {
7878
EXPECT_TRUE(IsAccessibleMemoryRange(mem + 2 * page_size, page_size));
7979
EXPECT_FALSE(IsAccessibleMemoryRange(mem, 3 * page_size));
8080
EXPECT_FALSE(IsAccessibleMemoryRange(0x0, 2));
81-
82-
munmap((void *)mem, 3 * page_size);
8381
}
8482

8583
TEST(SanitizerCommon, IsAccessibleMemoryRangeLarge) {
86-
const int size = GetPageSize() * 10000;
87-
88-
uptr mem = (uptr)mmap(0, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON,
89-
-1, 0);
90-
91-
EXPECT_TRUE(IsAccessibleMemoryRange(mem, size));
92-
93-
munmap((void *)mem, size);
84+
InternalMmapVector<char> buffer(10000 * GetPageSize());
85+
EXPECT_TRUE(IsAccessibleMemoryRange(reinterpret_cast<uptr>(buffer.data()),
86+
buffer.size()));
9487
}
9588

9689
} // namespace __sanitizer

flang/include/flang/Parser/dump-parse-tree.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -884,8 +884,10 @@ class ParseTreeDumper {
884884
} else if constexpr (HasSource<T>::value) {
885885
return x.source.ToString();
886886
#endif
887-
} else if constexpr (std::is_same_v<T, std::string>) {
888-
return x;
887+
} else if constexpr (std::is_same_v<T, int>) {
888+
return std::to_string(x);
889+
} else if constexpr (std::is_same_v<T, bool>) {
890+
return x ? "true" : "false";
889891
} else {
890892
return "";
891893
}

flang/test/Parser/OpenMP/allocate-tree.f90

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,19 @@ program allocate_tree
1818
allocate(w, xarray(4), zarray(t, z))
1919
end program allocate_tree
2020

21+
!CHECK: | | DeclarationConstruct -> SpecificationConstruct -> TypeDeclarationStmt
22+
!CHECK-NEXT: | | | DeclarationTypeSpec -> IntrinsicTypeSpec -> IntegerTypeSpec ->
23+
!CHECK-NEXT: | | | AttrSpec -> Allocatable
24+
!CHECK-NEXT: | | | EntityDecl
25+
!CHECK-NEXT: | | | | Name = 'w'
26+
!CHECK-NEXT: | | | EntityDecl
27+
!CHECK-NEXT: | | | | Name = 'xarray'
28+
!CHECK-NEXT: | | | | ArraySpec -> DeferredShapeSpecList -> int = '1'
29+
!CHECK-NEXT: | | | EntityDecl
30+
!CHECK-NEXT: | | | | Name = 'zarray'
31+
!CHECK-NEXT: | | | | ArraySpec -> DeferredShapeSpecList -> int = '2'
32+
33+
2134
!CHECK: | | ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPExecutableAllocate
2235
!CHECK-NEXT: | | | Verbatim
2336
!CHECK-NEXT: | | | OmpClauseList ->

0 commit comments

Comments
 (0)