lkml.org 
[lkml]   [1998]   [Aug]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectBroken fix for gcc-2.7 breakage wrt empty structures in 2.1.115-4
Date
From
The gcc-2.7.2.3 and earlier bug is architecture independent AFAIK (at least
i586-linux, SPARC-solaris are affected), but it's only fixed (halfway?) by:

> ---
> v2.1.114/linux/include/asm-i386/spinlock.h Mon Aug 3 17:48:28 1998
> +++ linux/include/asm-i386/spinlock.h Tue Aug 4 13:15:49 1998
> @@ -9,9 +9,16 @@
>
> /*
> * Your basic spinlocks, allowing only a single CPU anywhere
> + *
> + * Gcc-2.7.x has a nasty bug with empty initializers.

The bug is with empty initializers for empty structures after bitfields. My
original bug report for gcc (May 01, 1997) has the example:

struct {
int i:1;
struct { } e;
}
crashit = { 0, {} };

> */
> -typedef struct { } spinlock_t;
> -#define SPIN_LOCK_UNLOCKED { }
> +#if (__GNUC__ > 2) || (__GNUC_MINOR__ >= 8)

_I_ do know there was no gcc-1.8... but why not do it cleanly? It costs an
infinitesimal extra amount of time while compiling, perhaps. Use the
following to check if the error is present:

#if (__GNUC__ < 2) || (__GNUC__ == 2 && __GNUC_MINOR <= 7)

> + typedef struct { } spinlock_t;
> + #define SPIN_LOCK_UNLOCKED { 0 }

So an empty structure gets initialized with a structure containing 0!?
--
Horst von Brand vonbrand@sleipnir.valparaiso.cl
Casilla 9G, Viña del Mar, Chile +56 32 672616

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html

\
 
 \ /
  Last update: 2005-03-22 13:43    [W:0.030 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site