delorie.com/archives/browse.cgi | search |
X-Authentication-Warning: | delorie.com: mail set sender to djgpp-workers-bounces using -f |
X-Recipient: | djgpp-workers AT delorie DOT com |
Message-ID: | <529509C7.1070800@gmx.de> |
Date: | Tue, 26 Nov 2013 21:51:19 +0100 |
From: | Juan Manuel Guerrero <juan DOT guerrero AT gmx DOT de> |
User-Agent: | Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 |
MIME-Version: | 1.0 |
To: | djgpp-workers AT delorie DOT com |
Subject: | Re: Wrong order of memalign arguments |
References: | <5293DBB3 DOT 6020501 AT gmx DOT de> <52945E44 DOT 70901 AT iki DOT fi> |
In-Reply-To: | <52945E44.70901@iki.fi> |
X-Provags-ID: | V03:K0:A3Z7G0LDRz2nfQqmnlKkm4lBCNsyLJ+eWxUhcKlQFc33poDk7hA |
BTOD5A7WhrA1DEDS4FVowlbisOUSC8Zu+cynVBaPJsJCWW81G6KwcIG1q+FqGA/A1FEDGxQ | |
4e0Vpc/Rp7KSQ1r3SLVgH16e5CQoOxx75zwZxPMqIhbVxhlRX7qpm8mYeUCbil6T4iFnChO | |
DXOQOsuFP9VKi5m7XdMQQ== | |
Reply-To: | djgpp-workers AT delorie DOT com |
Am 26.11.2013 09:39, schrieb Andris Pavenis: > On 11/26/2013 01:22 AM, Juan Manuel Guerrero wrote: >> As Rugxulo pointed out a couple of days before there is a very serious bug in >> memalign. It concerns the reversed order of memalign arguments. From the very >> first check in of this file, the function arguments were swapped. I am not >> familiar enough with unix and bsd history, so I do not know if the reversed >> argument order was ever the right order. According to my linux man page this >> is not the case. > > Succeeded to dig out the first Linux distribution which I have tried 18 years > ago (Slackware 3.0, released in 1995). It has arguments in the same order as now > in Linux. I do not know about more ancient times though > I think we agree that the current argument order of memalign is wrong and must be fixed. The correct order is the one used in any posix compliant system and it is the reverse order than the order used by djgpp. Also all functions that use memalign in the c library must be adjusted accordingly. AFAIK it is only valloc. To be C99 compliant, the memalign declaration should be moved to somewhere else. Following linux and moving it into malloc.h seems OK to me. valloc declaration may stay in stdlib.h. But I am open for suggestions. > Perhaps nobody noticed that arguments are in wrong order in 2001 > > Also saw that nmalloc has the same wrong argument order. I'm using > nmalloc for DJGPP port of GCC (DJGPP v2.04 own malloc or more exactly > free() is too slow). Fortunately memalign is not used in GCC parts > supported for DJGPP native build, so nothing gets broken. > > Andris > I think CBFalconer copied the argument sequence from memalign for his nmalloc. So it must be fixed there too. I will wait some time; if I get no objections I will commit the patch I send in my last mail. Regards, Juan M. Guerrero
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |