#2917: alloca and allocaArray do not respect alignment
-------------------------------+--------------------------------------------
    Reporter:  guest           |        Owner:                  
        Type:  bug             |       Status:  new             
    Priority:  high            |    Milestone:  6.10.2          
   Component:  Compiler (FFI)  |      Version:  6.10.1          
    Severity:  normal          |   Resolution:                  
    Keywords:                  |   Difficulty:  Unknown         
    Testcase:                  |           Os:  Unknown/Multiple
Architecture:  x86             |  
-------------------------------+--------------------------------------------
Comment (by igloo):

 I'm a little nervous about rushing this in, particularly as it changes
 (adds to) some APIs, and I'm not sure exactly what the behaviour should
 be.

 You say
 {{{
 mallocAlignment :: Int
 mallocAlignment = 16
 allocaAlignment :: Int
 allocaAlignment = 8
 }}}
 but my manpage says
 {{{
 GNU libc malloc() always returns 8-byte aligned  memory  addresses
 }}}
 Where did 16 come from? It also seems strange to me that `allocaAlignment`
 should be different to `mallocAlignment`.

 According to my OS X manpages, OS X doesn't have `posix_memalign` or
 `memalign`, although it does have `valloc` ("The allocated memory is
 aligned on a page boundary."). However, for all the allocation functions
 on OS X, "The allocated memory is aligned such that it can be used for any
 data type, including AltiVec- and SSE-related types.". So if we're told
 the alignment is 32, and we get memory 16-byte aligned, should we fail?
 It's not clear to me.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2917#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to