[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <xnbopg8lex.fsf@greed.delorie.com>
Date: Fri, 03 Feb 2012 01:45:42 -0500
From: DJ Delorie <dj@...hat.com>
To: LKML <linux-kernel@...r.kernel.org>
Cc: linux-ia64@...r.kernel.org,
Linus Torvalds <torvalds@...ux-foundation.org>,
dsterba@...e.cz, ptesarik@...e.cz, rguenther@...e.de,
gcc@....gnu.org
Subject: Re: Memory corruption due to word sharing
Jan Kara <jack@...e.cz> writes:
> we've spotted the following mismatch between what kernel folks expect
> from a compiler and what GCC really does, resulting in memory corruption on
> some architectures. Consider the following structure:
> struct x {
> long a;
> unsigned int b1;
> unsigned int b2:1;
> };
If this structure were volatile, you could try
-fstrict-volatile-bitfields, which forces GCC to use the C type to
define the access width, instead of doing whatever it thinks is optimal.
Note: that flag is enabled by default for some targets already, most
notably ARM.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists