Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 24 Aug 2012 08:35:52 -0400
From: Rich Felker <dalias@...ifal.cx>
To: musl@...ts.openwall.com
Subject: Re: build musl with clang

On Fri, Aug 24, 2012 at 06:22:11PM +0600, agent wrote:
> f: # @f
> # BB#0: # %entry
> subl $12, %esp
> movl $100, (%esp)
> calll malloc
> testl %eax, %eax
> je .LBB0_2
> # BB#1: # %if.then
> movb $0, (%eax)
> ..LBB0_2: # %if.end
> addl $12, %esp
> ret
> 
> i suppose, 'if' is not elliminated.
> 
> but if i create a function f2 with contents of musl's calloc it
> fails the test.
> 
> then i noticed in musl's calloc a cycle is wrapped into an 'if' with
> p with negative subscript and tried the following:

Does it work if you change the check not to use p[-1] but instead use:

*(size_t *)((char *)p - sizeof(size_t))

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.