bug-parted
[Top][All Lists]
Advanced

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

Re: gcc bug causes parted to write bad GPT entries


From: Richard Hirst
Subject: Re: gcc bug causes parted to write bad GPT entries
Date: Mon, 18 Mar 2002 10:36:03 +0000
User-agent: Mutt/1.3.24i

On Sat, Mar 16, 2002 at 12:31:56PM +1100, Andrew Clausen wrote:
> On Sat, Mar 16, 2002 at 01:14:13AM +0000, Richard Hirst wrote:
> > On Sat, Mar 16, 2002 at 12:01:17PM +1100, Andrew Clausen wrote:
> > > Anyway, I don't trust compilers, unless some language lawyer can
> > > prove that it will always work without ((packed)).
> > 
> > Well, I could put ((packed)) if gcc was 3.1 or better, assuming my tests
> > are successful.
> 
> Are gcc 2.x and 3.0 still maintained?

I asked the question:

> On Mon, Mar 18, 2002 at 09:32:44AM +0000, Richard Hirst wrote:
> >   Are fixed versions of 2.96 and 3.0 likely to appear, or do I have to
> > code round the problem until 3.1+ becomes the standard compiler?
> 
> Fixed 2.96-RH version is going to appear fairly soon, the rest (GNUPro
> 2.96 and 3.0 I have no control about).
> 
>         Jakub

Anyway, a work-a-round for the problem (removing the packed attribute)
is attached, and works fine in my tests.  Still leaves the problem of
byte ordering when interfacing to libuuid, which I'll address in a
seperate mail.

Richard


diff -ur parted-1.4.24-1.ori/include/parted/disk_gpt.h 
parted-1.4.24-1.fix.no-packed/include/parted/disk_gpt.h
--- parted-1.4.24-1.ori/include/parted/disk_gpt.h       Mon Oct  1 22:06:33 2001
+++ parted-1.4.24-1.fix.no-packed/include/parted/disk_gpt.h     Mon Mar 18 
10:27:54 2002
@@ -49,7 +49,14 @@
         uint8_t  clock_seq_hi_and_reserved;
         uint8_t  clock_seq_low;
         uint8_t  node[6];
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR > 0)
 } __attribute__ ((packed)) efi_guid_t;
+#else
+/* ((packed)) here exposes a bug in older versions of gcc.  Structure is
+ * naturally packed anyway, so it doesn't strictly matter.
+ */
+} efi_guid_t;
+#endif
 
 
 #define UNUSED_ENTRY_GUID    \




reply via email to

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