On Mon, 15.07.13 19:55, Shawn ([email protected]) wrote:

> On Mon, Jul 15, 2013 at 7:26 PM, Lennart Poettering
> <[email protected]>wrote:
> 
> > On Mon, 15.07.13 18:22, Shawn Landden ([email protected]) wrote:
> >
> > > these warnings on !x86 arches for good code are annoying, and
> > > there is no way to mark the offending code safe, so I guess we are
> > > just going to have to deal with the resulting problems as we
> > > come across them. Also, these warnings are present for armv6+armv7,
> > > when they moreso effect armv5.
> >
> > Hmm, can you elaborate on the particular places where this happens? I
> > have not been aware of any issues regarding this (not surprising since I
> > am a boring x86 user...)
> >
> Here is the full build log on armhf. I looked at the source for some of
> these about a year ago, after the udev merge. Basically, you allocate
> some type to 1-byte aligned, and then you cast it to a type that requries
> 4-bytes aligned, and on arches that do
> not support unaligned accesses, Bad Things (tm) happen. I ran systemd on
> armv5 for quite some time and never had problems, however, but fewer people
> are probably testing that now. (I don't have the hardware anymore)

Hmm, malloc() is guaranteed to pointers that are aligned to the maximum
alignment, so that part should safe.

I figure most of these gcc warnings are indeed non-issues, but I am
pretty sure we should individually fix or suppress them rather than just
turn off the warnings globally.

Usually issues like these can be fixed by replacing casts by unions, or
by decorating variables with alignment attributes. I am not sure what
the official way is to tell the compiler that a specific cast is
verified to be OK and that the compiler should shut up about it
though...

Lennart

-- 
Lennart Poettering - Red Hat, Inc.
_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to