Skip to content
Snippets Groups Projects
Commit de5ce6d4 authored by stijn's avatar stijn
Browse files

gc: Use simple cast instead of union to silence compiler

parent 8abcf666
Branches
No related tags found
No related merge requests found
......@@ -144,15 +144,7 @@ void gc_collect(void) {
regs_t regs;
gc_helper_get_regs(regs);
// GC stack (and regs because we captured them)
#ifdef __MINGW32__
// The Mingw cross-compiler on Travis complains
// 'warning: dereferencing type-punned pointer will break strict-aliasing rules'
// when casting &regs to void** directly so use a union.
union { regs_t *r; void **ptr; } cast_regs = { &regs };
void **regs_ptr = cast_regs.ptr;
#else
void **regs_ptr = (void**)&regs;
#endif
void **regs_ptr = (void**)(void*)&regs;
gc_collect_root(regs_ptr, ((machine_uint_t)stack_top - (machine_uint_t)&regs) / sizeof(machine_uint_t));
gc_collect_end();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment