[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: gcc bug causes parted to write bad GPT entries

From: Matt_Domsch
Subject: RE: gcc bug causes parted to write bad GPT entries
Date: Tue, 19 Mar 2002 15:36:24 -0600

> On Sat, Mar 16, 2002 at 12:40:31AM +0000, Richard Hirst wrote:
> > Another possible option is to simply remove the ((packed)) attribute
> > from the struct definition:
> Anyway, I don't trust compilers, unless some language lawyer can
> prove that it will always work without ((packed)).
> Even if the lawyer can prove it, it still seems better (in general)
> to put the ((packed)) thing in, to document that we ARE worried
> about the physical layout of the struct.  (We could comment that
> out in this case, because it tickles a gcc bug, but that's how
> I would prefer to do it, anyway)

So, what else could ((packed)) break? :-(

In the kernel, I'm using it on all the on-disk structures.
gpt_header, gpt_entry, legacy_mbr.  Of these, the first two are already
naturally aligned as either dwords or qwords (there are no smaller members
in there).  

Legacy_mbr, in particular, does structure member dereferences that are most
certainly not dword-aligned (there's a u16 'unknown' field in there prior to
the start of the partition table proper).

Have we just gotten lucky all this time?  I guess so!

-Matt (I hate compiler bugs)

Matt Domsch
Sr. Software Engineer
Dell Linux Solutions www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com
#1 US Linux Server provider for 2001!

reply via email to

[Prev in Thread] Current Thread [Next in Thread]