Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 40fc9de

Browse files
committed
Fix brick table issue on Unix
There is a problem with Clang compiling a loop that sets a range of brick table entries that are "shorts" as a memset. That causes it to be written by bytes in some cases on OSX (and it is a mere chance that the memset on Linux is implemented so that it doesn't use byte access). This was causing corruption of the brick table on OSX. The fix is to mark the pointer that iterates over the brick table as volatile to prevent the compiler from using the memset.
1 parent 1e966cc commit 40fc9de

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/gc/gc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11177,7 +11177,7 @@ void gc_heap::adjust_limit_clr (uint8_t* start, size_t limit_size,
1117711177
b++;
1117811178
dprintf (3, ("Allocation Clearing bricks [%Ix, %Ix[",
1117911179
b, brick_of (align_on_brick (start + limit_size))));
11180-
short* x = &brick_table [b];
11180+
volatile short* x = &brick_table [b];
1118111181
short* end_x = &brick_table [brick_of (align_on_brick (start + limit_size))];
1118211182

1118311183
for (;x < end_x;x++)

0 commit comments

Comments
 (0)