|
|
Message-ID: <20120824145938.GA7705@port70.net>
Date: Fri, 24 Aug 2012 16:59:39 +0200
From: Szabolcs Nagy <nsz@...t70.net>
To: musl@...ts.openwall.com
Subject: Re: build musl with clang
* agent <agentprog@...il.com> [2012-08-24 18:22:11 +0600]:
> p with negative subscript and tried the following:
>
> void *f1() {
> char *p;
> int i;
>
> p = malloc(100);
> if (p[-1])
> p[0] = 0;
>
> return p;
> }
>
> and that's i we get:
>
> f1: # @f1
> # BB#0: # %if.end
> subl $12, %esp
> movl $100, (%esp)
> calll malloc
> movb $0, (%eax)
> addl $12, %esp
> ret
>
> but if we have if (p && p[-1]) -- 'if' is not optimized out.
now that seems wrong (if it was compiled with -ffreestanding)
'if (p[-1])' is dropped even though malloc can put there anything
this should be reported to the clang list
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.