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 11:58:51 +0600
From: agent <>
Subject: Re: build musl with clang

23.08.2012 23:55, Rich Felker пишет:
> The bug is that clang assumes the memory returned from malloc has
> indeterminate contents, which is only a valid assumption on a hosted
> implementation. On a freestanding one, malloc is just another ordinary
> function with no special semantics. Anyway, based on the wrong
> assumption, it optimizes out the zero-fill code that's of the form
> for (i=0; i<n; i++) if (mem[i]) mem[i] = 0;
> I am not willing to remove the if, because it serves a valuable
> purpose: it avoids writing to pages that are already all-zero, which
> in turn reduces swap pressure/dirty pages.
> Rich
even if it assumes the memory has indeterminate contents, indeterminate 
isn't zero so i feel there is no real reason to wipe the whole cycle out 
only because of if statement -- malloc does not have to (and should not) 
zero fill the returned memory.

at least as calloc.c is as separate file in musl it can be compiled with 
a different optimization, though i have never tried to mix code with 
different optimization and i don't know any side effects of it.

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.