File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -342,9 +342,19 @@ void gc_collect_start(void) {
342
342
#endif
343
343
}
344
344
345
+ // Address sanitizer needs to know that the access to ptrs[i] must always be
346
+ // considered OK, even if it's a load from an address that would normally be
347
+ // prohibited (due to being undefined, in a red zone, etc).
348
+ #ifdef __GNUC__
349
+ __attribute__((no_sanitize_address ))
350
+ #endif
351
+ static void * gc_get_ptr (void * * ptrs , int i ) {
352
+ return ptrs [i ];
353
+ }
354
+
345
355
void gc_collect_root (void * * ptrs , size_t len ) {
346
356
for (size_t i = 0 ; i < len ; i ++ ) {
347
- void * ptr = ptrs [ i ] ;
357
+ void * ptr = gc_get_ptr ( ptrs , i ) ;
348
358
if (VERIFY_PTR (ptr )) {
349
359
size_t block = BLOCK_FROM_PTR (ptr );
350
360
if (ATB_GET_KIND (block ) == AT_HEAD ) {
You can’t perform that action at this time.
0 commit comments