Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 76a068a898b591726054e67639a3678efc7fb405
Ticket: 2184717fffffffffffffffffffffffffffffffff
unaligned malloc() -> Tcl panic
User & Date: cc_benny on 2008-10-24 22:02:19
Changes

  1. icomment:
    Are you sure you have the right culprit here?  What you
    describe sounds like a bug in ElectricFence or maybe
    somewhere else.
    
    > Tcl's Tcl_Alloc() routine (and the ckalloc() form) is
    > documented to return a pointer aligned for any purpose.
    
    This is the same guarantee that malloc gives.  I checked the
    C standard as well as my local man pages (on Mac OS X) about
    this.  See also
    <http://www.opengroup.org/onlinepubs/009695399/functions/malloc.html>.
    
    > Unfortunately, when malloc() returns a pointer that is
    > misaligned for some purposes (notably for holding a
    > pointer value)
    
    That implementation of malloc would be broken.
    
    Note that there are no simple functions in standard C that
    can be used to ensure alignment and that a portable
    implementation to do this is non-trivial (from the POV of
    the rather generic C standard at least).  A malloc that does
    not ensure alignment would be unreasonable or even useless.
    
    
    
  2. login: "cc_benny"
  3. mimetype: "text/plain"
  4. username: "cc_benny"