[HACKERS] More bogus alignment assumptions

2001-03-25 Thread Tom Lane

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

---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])



Re: [HACKERS] More bogus alignment assumptions

2001-03-25 Thread Bruce Momjian

 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.

Added to TODO:

* Remove warnings created by -Wcast-align

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 853-3000
  +  If your life is a hard drive, |  830 Blythe Avenue
  +  Christ can be your backup.|  Drexel Hill, Pennsylvania 19026

---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]