On 03/27/2017 07:34 PM, Peter Maydell wrote:
> That all makes sense in isolation, but shouldn't something have
> at least warned that "&h.size" isn't actually a uint32_t* in
> the sense of being something you can validly pass to a
> function that takes a uint32_t* ?
It turns out that clang actually emits a warning in this case:
root@deb4g:~# clang-4.0 packed.c -o packed
packed.c:18:18: warning: taking address of packed member 'size' of class or
structure 'hdr' may result in an unaligned pointer value
[-Waddress-of-packed-member]
return getval(&h.size);
^~~~~~
1 warning generated.
root@deb4g:~#
Adrian
--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer - [email protected]
`. `' Freie Universitaet Berlin - [email protected]
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913