gc: Use simple cast instead of union to silence compiler
This commit is contained in:
parent
8abcf666cb
commit
de5ce6d461
@ -144,15 +144,7 @@ void gc_collect(void) {
|
|||||||
regs_t regs;
|
regs_t regs;
|
||||||
gc_helper_get_regs(regs);
|
gc_helper_get_regs(regs);
|
||||||
// GC stack (and regs because we captured them)
|
// GC stack (and regs because we captured them)
|
||||||
#ifdef __MINGW32__
|
void **regs_ptr = (void**)(void*)®s;
|
||||||
// The Mingw cross-compiler on Travis complains
|
|
||||||
// 'warning: dereferencing type-punned pointer will break strict-aliasing rules'
|
|
||||||
// when casting ®s to void** directly so use a union.
|
|
||||||
union { regs_t *r; void **ptr; } cast_regs = { ®s };
|
|
||||||
void **regs_ptr = cast_regs.ptr;
|
|
||||||
#else
|
|
||||||
void **regs_ptr = (void**)®s;
|
|
||||||
#endif
|
|
||||||
gc_collect_root(regs_ptr, ((machine_uint_t)stack_top - (machine_uint_t)®s) / sizeof(machine_uint_t));
|
gc_collect_root(regs_ptr, ((machine_uint_t)stack_top - (machine_uint_t)®s) / sizeof(machine_uint_t));
|
||||||
gc_collect_end();
|
gc_collect_end();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user