More bogus alignment assumptions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: More bogus alignment assumptions
Date: 2001-03-25 21:27:53
Message-ID: 19465.985555673@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Following up on the recent bug report from Steve Nicolai, I spent a
tedious hour groveling through all the warnings emitted by gcc with
-Wcast-align. (We ought to try to reduce the number of them, but that's
a task for another day.)

I found seven places, in addition to the tuptoaster.c error originally
identified by Steve, in which the code is assuming that a "char foo[N]"
local variable will be aligned on better-than-char boundaries by the
compiler. All were inserted since 7.0. All but one were inserted by
Vadim in the new WAL code; the other one is in large-object support
and is my fault :-(

I will fix these shortly, but I wanted to raise a flag to people:
don't do that. An array of X is not guaranteed to be aligned any
better than an X is.

regards, tom lane

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2001-03-25 21:41:40 Re: More bogus alignment assumptions
Previous Message Tom Lane 2001-03-25 21:07:13 Re: Re: Call for platforms