[Patches] [ python-Patches-511449 ] PyBuffer_New double alignment bugfix

noreply@sourceforge.net noreply@sourceforge.net
Thu, 31 Jan 2002 14:16:33 -0800


Patches item #511449, was opened at 2002-01-31 14:16
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=511449&group_id=5470

Category: Core (C code)
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Jay T Miller (jaytmiller)
Assigned to: Nobody/Anonymous (nobody)
Summary: PyBuffer_New double alignment bugfix

Initial Comment:
PyBuffer_New performs a single malloc to allocate a
buffer object and its associated storage.  In
Python-2.2 the object is double aligned, but the
storage is not guaranteed to be double aligned.  See
bug #472568 by Frederic Giacometti.

This patch adds a padding double to the buffer object
and code which truncates the storage pointer to a
double aligned boundary within the padding.  Frederic's
original suggestion was cleaner, but appeared to
require an extra compiler switch to get double
alignment for gcc i386.   Since the info page for gcc
-malign-double warns: 

*Warning:* if you use the `-malign-double' switch,
structures containing the above types will be aligned
differently than the published application binary
interface specifications for the 386.

I figured the switch was a bad idea,  so I used
truncating division instead of Frederic's clean pointer
trick.


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=511449&group_id=5470