delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2018/11/21/07:17:42

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
X-Recipient: djgpp-workers AT delorie DOT com
Date: Wed, 21 Nov 2018 23:17:21 +1100
From: Peter Ross <pross AT xvid DOT org>
To: djgpp-workers AT delorie DOT com
Subject: memalign broken (again)
Message-ID: <20181121121721.GA1501@b21e7fa156c1e52f6cc3a9e0ddf22975>
MIME-Version: 1.0
User-Agent: Mutt/1.9.4 (2018-02-28)
Reply-To: djgpp-workers AT delorie DOT com

--8t9RHnE3ZwKMSgU+
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

hi,

djgpp memalign still fails when:

	1. alignment is >= 16 bytes
	2. some sequence of memory allocations have already occured.

the test case below is reproducible with djgpp cvs and 2.05+nmemalign.patch
(patch was found here: https://aur.archlinux.org/cgit/aur.git/tree/nmemalign.patch?h=dosbox-djcrx)

tested using freedos 1.2 on physical hardware.

---
#include <stdio.h>
#include <malloc.h>

#define TEST(alignment, size) \
        printf("memalign(%d,%d)=", alignment, size); \
        ptr = memalign(alignment, size); \
        printf("%p\n", ptr);

int main()
{
    void * ptr;
    TEST(1, 46)
    TEST(4, 583)
    TEST(64, 773)
    TEST(32, 889)  /* <-- reliably fails here */
    return 0;
}
---

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)

--8t9RHnE3ZwKMSgU+
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iF0EABECAB0WIQSpB+AvpuUM0jTNINJnYHnFrEDdawUCW/VMzgAKCRBnYHnFrEDd
a9dzAJ91BK27YetzfmcTuoGlyrqnlJQDGQCdF4R2Fm3JY1oEN08sDirTRMzCiU8=
=raZy
-----END PGP SIGNATURE-----

--8t9RHnE3ZwKMSgU+--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019