From b9a7cce2329378169e383566c6c737cf37d82a49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa?= Date: Tue, 15 Feb 2011 18:40:34 +0000 Subject: [PATCH] fix aliasing warning. --- OPTYap/tab.tries.insts.i | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/OPTYap/tab.tries.insts.i b/OPTYap/tab.tries.insts.i index e7e34c041..63f0dad9d 100644 --- a/OPTYap/tab.tries.insts.i +++ b/OPTYap/tab.tries.insts.i @@ -1082,22 +1082,24 @@ int heap_arity = aux_stack[HEAP_ARITY_ENTRY]; int vars_arity = aux_stack[VARS_ARITY_ENTRY]; int subs_arity = aux_stack[SUBS_ARITY_ENTRY]; - volatile Float dbl; - volatile Term *t_dbl = (Term *)((void *) &dbl); + volatile union { + Float dbl; + Term ts[SIZEOF_DOUBLE/SIZEOF_INT_P]; + } td; Term t; #if SIZEOF_DOUBLE == 2 * SIZEOF_INT_P - t_dbl[0] = aux_stack[HEAP_ENTRY(1)]; - t_dbl[1] = aux_stack[HEAP_ENTRY(3)]; /* jump the first extension mark */ + td.ts[0] = aux_stack[HEAP_ENTRY(1)]; + td.ts[1] = aux_stack[HEAP_ENTRY(3)]; /* jump the first extension mark */ heap_arity -= 4; TOP_STACK = aux_stack = &aux_stack[4]; /* jump until the second extension mark */ #else /* SIZEOF_DOUBLE == SIZEOF_INT_P */ - t_dbl[0] = aux_stack[HEAP_ENTRY(1)]; + td.ts[0] = aux_stack[HEAP_ENTRY(1)]; heap_arity -= 2; TOP_STACK = aux_stack = &aux_stack[2]; /* jump until the extension mark */ #endif /* SIZEOF_DOUBLE x SIZEOF_INT_P */ TOP_STACK[HEAP_ARITY_ENTRY] = heap_arity; - t = MkFloatTerm(dbl); + t = MkFloatTerm(td.dbl); aux_stack_term_instr(); ENDPBOp();