From: [email protected]
> Sent: 15 October 2020 22:35
> >Don't perform unaligned loads in __get_next and __peek_nbyte_next as
> >these are forms of undefined behavior.
...
> > #define __get_next(t, insn) \
> >-    ({ t r = *(t*)insn->next_byte; insn->next_byte += sizeof(t); r; })
> >+    ({ t r; memcpy(&r, insn->next_byte, sizeof(t)); insn->next_byte += 
> >sizeof(t); r; })

Interesting other idea.
Can you add an 'aligned(1)' into the '*(t *)' cast?
I think '*(t aligned(1) *)' is the right cast.
(gcc seems to accept it either size of the type.)

        David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, 
UK
Registration No: 1397386 (Wales)

Reply via email to