mailing list of musl libc
 help / color / mirror / code / Atom feed
* cluts - posix_memalign test
@ 2011-07-05  0:44 Rich Felker
  2011-07-05 10:25 ` Luka Marčetić
  0 siblings, 1 reply; 2+ messages in thread
From: Rich Felker @ 2011-07-05  0:44 UTC (permalink / raw)
  To: musl

I recently fixed the issue with musl's posix_memalign not returning
failure when the align argument is smaller than sizeof(size_t), but
cluts is still throwing an error in that case:

W:posix_memalign returned EINVAL, but gave a non-NULL pointer (alignment=1)

I believe this error is mistaken. posix_memalign is not giving a
non-NULL pointer to the caller. Rather the caller is seeing the value
it wrote to the pointer before making the call.

I suppose some versions of posix_memalign might clear the pointer to
null if allocation fails, but I could find no text in the standard
that requires or even allows posix_memalign to modify the pointer when
it fails, so at present musl does not touch it.

I'd welcome input from anyone who has a good argument that this is
incorrect, but short of that, I think cluts is checking a condition
that need not (and maybe can't) be true.

Rich


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: cluts - posix_memalign test
  2011-07-05  0:44 cluts - posix_memalign test Rich Felker
@ 2011-07-05 10:25 ` Luka Marčetić
  0 siblings, 0 replies; 2+ messages in thread
From: Luka Marčetić @ 2011-07-05 10:25 UTC (permalink / raw)
  To: musl

On 07/05/2011 02:44 AM, Rich Felker wrote:
> W:posix_memalign returned EINVAL, but gave a non-NULL pointer (alignment=1)
> I suppose some versions of posix_memalign might clear the pointer to
> null if allocation fails, but I could find no text in the standard
> that requires or even allows posix_memalign to modify the pointer when
> it fails, so at present musl does not touch it.
>
> I'd welcome input from anyone who has a good argument that this is
> incorrect, but short of that, I think cluts is checking a condition
> that need not (and maybe can't) be true.
>
> Rich

Technically, it was a warning (prints to stdout and doesn't set an 
error), but you're right. It's what malloc and calloc should do, not 
posix_memalign, so it shouldn't be there in the first place. Removed it. 
Thanks.

Speaking of malloc.c, I changed my mind about rewriting it this week, in 
favor of writing more new code (framework and tasks). The test seems to 
work even though it's awful(ly slow), so it'll have to do for now.
-Luka


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-07-05 10:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-05  0:44 cluts - posix_memalign test Rich Felker
2011-07-05 10:25 ` Luka Marčetić

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).