Skip to content

Commit de5ce6d

Browse files
committed
gc: Use simple cast instead of union to silence compiler
1 parent 8abcf66 commit de5ce6d

1 file changed

Lines changed: 1 addition & 9 deletions

File tree

unix/gccollect.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -144,15 +144,7 @@ void gc_collect(void) {
144144
regs_t regs;
145145
gc_helper_get_regs(regs);
146146
// GC stack (and regs because we captured them)
147-
#ifdef __MINGW32__
148-
// The Mingw cross-compiler on Travis complains
149-
// 'warning: dereferencing type-punned pointer will break strict-aliasing rules'
150-
// when casting &regs to void** directly so use a union.
151-
union { regs_t *r; void **ptr; } cast_regs = { &regs };
152-
void **regs_ptr = cast_regs.ptr;
153-
#else
154-
void **regs_ptr = (void**)&regs;
155-
#endif
147+
void **regs_ptr = (void**)(void*)&regs;
156148
gc_collect_root(regs_ptr, ((machine_uint_t)stack_top - (machine_uint_t)&regs) / sizeof(machine_uint_t));
157149
gc_collect_end();
158150

0 commit comments

Comments
 (0)