This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Memory corruption due to word sharing
- From: Michael Matz <matz at suse dot de>
- To: Aldy Hernandez <aldyh at redhat dot com>
- Cc: Linus Torvalds <torvalds at linux-foundation dot org>, Jakub Jelinek <jakub at redhat dot com>, Torvald Riegel <triegel at redhat dot com>, Jan Kara <jack at suse dot cz>, LKML <linux-kernel at vger dot kernel dot org>, linux-ia64 at vger dot kernel dot org, dsterba at suse dot cz, ptesarik at suse dot cz, rguenther at suse dot de, gcc at gcc dot gnu dot org
- Date: Thu, 2 Feb 2012 17:28:30 +0100 (CET)
- Subject: Re: Memory corruption due to word sharing
- References: <20120201151918.GC16714@quack.suse.cz> <CA+55aFy55Q=+pFCZcS9cOM6SL+ZT3sNDB+c4qFvVqwwSpTqJ7g@mail.gmail.com> <1328118174.15992.6206.camel@triegel.csb> <20120201194025.GG6148@sunsite.ms.mff.cuni.cz> <CA+55aFzVWjqcs1zRF-93_9yHRDS-YgmpgFTzACw6HQ-059U06Q@mail.gmail.com> <20120201201631.GW18768@tyan-ft48-01.lab.bos.redhat.com> <CA+55aFwcLpD2Cw5VxZ3ym66QBDAeDam3-hprivrC+keUMXJOtw@mail.gmail.com> <874nv9qlau.fsf@houston.quesejoda.com>
Hi,
On Thu, 2 Feb 2012, Aldy Hernandez wrote:
> > Seriously - is there any real argument *against* just using the base
> > type as a hint for access size?
>
> If I'm on the hook for attempting to fix this again, I'd also like to
> know if there are any arguments against using the base type.
Sure. Simplest example: struct s {int i:24;} __attribute__((packed)).
You must access only three bytes, no matter what. The basetype (int) is
four bytes.
Ciao,
Michael.