Skip to content

Commit 1c6382a

Browse files
committed
CoreFoundation: add a workaround for Linux with the rebranch
This adds an optimization barrier in the loop that is potentially getting mis-optimized with the rebranch on Linux. This should allow us to rebranch and follow up with a proper fix subsequently. Thanks to @etcwilde for tracking down this issue!
1 parent 599c05d commit 1c6382a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

CoreFoundation/String.subproj/CFAttributedString.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,9 @@ CFDictionaryRef CFAttributedStringGetAttributesAndLongestEffectiveRange(CFAttrib
350350
// Now go back and set leftEnd
351351
tmpRange = *longestEffectiveRange;
352352
do {
353+
#if defined(__linux__)
354+
__asm__ __volatile__("" : : : "memory");
355+
#endif
353356
if ((leftEnd = tmpRange.location) <= rangeLimit.location) break;
354357
other = CFAttributedStringGetAttributes(attrStr, leftEnd - 1, &tmpRange);
355358
} while (CFEqual(other, attrs));

0 commit comments

Comments
 (0)