From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mo4-p02-ob.smtp.rzone.de (mo4-p02-ob.smtp.rzone.de [85.215.255.84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2E23A146584 for ; Fri, 19 Jul 2024 17:13:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=85.215.255.84 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721409212; cv=pass; b=HS5xD67OAM7vTwylaMRwXtGkTPQJn8bt/w89F+R/FZJb9gsNeFnZVzz6Brz+SCgLUknI9l6oXQs/UYhKD/0yssNsc35hPGAZw+ipUoXxfi/3hn9rqVxXd9sGjFUsgyshvFAR8pHTEnDWhDuvrb0n2zu/NpvU0nc5i+cU8LUZyao= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721409212; c=relaxed/simple; bh=hHtHmnYGKF+/PxZThSPm0MqL+yM7affvDnT4tbXmj8U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=QiYCfu4zayaW8XKHtA4Tl3JgsmoRASsBAhvnQgidSr8LGi5DLuLa6Vpfw9ykN1H6Jk4kz9XXE7u5oLzuDnYTpC5jUMlJ2Dd8hzpquJdsUQC6wH86mPZX2VygRxhttmKJ7y+4QPsyeyZQzFQP7kJl9zujzb3AsbTbxmUgWiG4AUU= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=clisp.org; spf=none smtp.mailfrom=clisp.org; dkim=pass (2048-bit key) header.d=clisp.org header.i=@clisp.org header.b=LEYv38N8; dkim=permerror (0-bit key) header.d=clisp.org header.i=@clisp.org header.b=1q1hN4O2; arc=pass smtp.client-ip=85.215.255.84 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=clisp.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=clisp.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=clisp.org header.i=@clisp.org header.b="LEYv38N8"; dkim=permerror (0-bit key) header.d=clisp.org header.i=@clisp.org header.b="1q1hN4O2" ARC-Seal: i=1; a=rsa-sha256; t=1721409207; cv=none; d=strato.com; s=strato-dkim-0002; b=pvb4qt4VCsXo/PCsWfA/4fFTFZDu0W2rIYVP7Xi6jefEMKCDJ6DX9FLxKjnUsdV+6Q WoyMpX02axMufk7ygkTVPJqj2D1cR6PDM5URHbBOMyVeVFzLEEhCkGFcqG+lv/XTMZfi +1s+gFytKyXcn2ginTRlmgMJ0Cl9MyJEa1C/cSKbLyKW/U+UDeOHCUxYo5f2mTI7c7y2 AOjFpj2VjkAPXaRBLC1zSEnIB2LPUdbw+JhZpTV9yfLnbW5CPq8uv+Wc2vOigeGTfMv2 BDLdbGOlDSxeEZtkxJZTO1vZGhFgwGDGTBc+OAVS90FqIfKk0ZsBiFVR5riZDZLaDZQK ycIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1721409207; s=strato-dkim-0002; d=strato.com; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=4QE1TtquwJQsW+mtao3hj0wYgZSPlOZWh4eH6qb6iy8=; b=lnygRKn5ST2naPQs20uQUewFbC3cyDJ4wmOijgW9Qyxpxb4SMDIruP6v/Jct9hJ24C nxa11hEFb7JaMs6IDs5Jn9nN5jXl1SSgdO/k2+lJl01z0OqXiDUYs3gIZb7pguaU960K heCUm8eL1gR4GeldSISgeF/QJvgKO13sjn4P2xe2+oQou/iQXcZWclactpyMJXFpWrwp e8oRUwgzrTPlP+Frt3RRmi11wM1c7eF/6llV5iPSKqOS0md9luyZTFfnATN7mzxiIG2T aSZZUHepQRllJQhxQiPawsPiFCwyXkZFe5Oy2Ef8AD5V42Ue56kW7A/O5ymxHAYeQSkG 4whA== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo02 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1721409207; s=strato-dkim-0002; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=4QE1TtquwJQsW+mtao3hj0wYgZSPlOZWh4eH6qb6iy8=; b=LEYv38N8atBuoTFEltOgnXqn6bs/1yXQZPWtVRtyMNXVQF2QWoOqS2C43e+lRPDnPy +ikRAJk1Sz+2IRUnHnu0jBfrVYJfo03QlOGufY3jBVGh90wsqKKJNEIevagkxX+513V8 IUCdsaL16iHh4eGiF/mT89/mqh1JxPe300QD5oiQlvBthC0YqwVenKrU5iU4YCNvOLv4 5PQH8Be6jNxvqCyvH7ESgAUtmIFv4r/s85Ny2zkesfHwRcATdpZMzou5etYZhTQoET8F JEyU5qIe0PT7Is1SbiTstHIf1xqTDu+i42bZrMvQHrJ1k9W6QoBk9BFrGl2VQYF7q09I 2NNQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1721409207; s=strato-dkim-0003; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=4QE1TtquwJQsW+mtao3hj0wYgZSPlOZWh4eH6qb6iy8=; b=1q1hN4O2RF4A8kNUwOE4MV1npQ7tbZDB5T9RrieK3Cvh4q2L7ZpjdQqOLdiGklYF80 CNeU9FnaC85lMyNzbqBg== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH0WWb0LN8XZoH94zq68+3cfpOf3qMENF+YdjBlrsdCccsRIZP3tQ==" Received: from nimes.localnet by smtp.strato.de (RZmta 50.5.0 AUTH) with ESMTPSA id N0957e06JHDQGy6 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Fri, 19 Jul 2024 19:13:26 +0200 (CEST) From: Bruno Haible To: Alejandro Colomar Cc: bug-gnulib@gnu.org, Paul Eggert , =?utf-8?B?xJBvw6BuIFRy4bqnbiBDw7RuZw==?= Danh , Eli Schwartz , Sam James , Serge Hallyn , Iker Pedrosa , Michael Vetter , liba2i@lists.linux.dev Subject: Re: [PATCH v1] xstrtol: Remove dead code Date: Fri, 19 Jul 2024 19:13:25 +0200 Message-ID: <4253333.uADA5c2rLh@nimes> In-Reply-To: <2licxuxsw37hpyss5izkqu6x4lfwcduxwbrgw7a4fqaibydwlx@o6y73xqtyrnx> References: <20240718203147.47143-2-alx@kernel.org> <2licxuxsw37hpyss5izkqu6x4lfwcduxwbrgw7a4fqaibydwlx@o6y73xqtyrnx> Precedence: bulk X-Mailing-List: liba2i@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Alejandro Colomar wrote: > We'd need to know the precise specification of that system that can set > errno = ENOMEM. > > Is *endp guaranteed to be set? Or may it be unset (as happens with > EINVAL)? One system that calls malloc() during strtod() is NetBSD. See $ grep -ri malloc src/lib/libc/gdtoa/ src/lib/libc/gdtoa/g__fmt.c: if ((decimalpoint_cache = MALLOC(strlen(s0) + 1)) != NULL) { src/lib/libc/gdtoa/README:for intermediate quantities, and MALLOC (see gdtoaimp.h) is called only src/lib/libc/gdtoa/README:if the private pool does not suffice. 2000 is large enough that MALLOC src/lib/libc/gdtoa/gdtoaimp.h: * #define MALLOC your_malloc, where your_malloc(n) acts like malloc(n) src/lib/libc/gdtoa/gdtoaimp.h: * appropriate. If MALLOC is undefined, malloc will be invoked src/lib/libc/gdtoa/gdtoaimp.h: * recycle memory acquired from MALLOC, #define FREE to be the src/lib/libc/gdtoa/gdtoaimp.h: * suffices to get rid of MALLOC calls except for unusual cases, src/lib/libc/gdtoa/gdtoaimp.h:#ifdef MALLOC src/lib/libc/gdtoa/gdtoaimp.h:extern Char *MALLOC ANSI((size_t)); src/lib/libc/gdtoa/gdtoaimp.h:#define MALLOC malloc src/lib/libc/gdtoa/misc.c: rv = (Bigint *)MALLOC(sizeof(Bigint) + (x-1)*sizeof(ULong)); src/lib/libc/gdtoa/misc.c: rv = (Bigint*)MALLOC(len*sizeof(double)); Feel free to look up the source code in glibc, musl libc, FreeBSD, OpenBSD, Darwin, OpenSolaris, Android. And that still does not give information about Solaris and AIX. Here in the Gnulib project, we typically write a unit test that verifies the behaviour/properties we expect from a certain libc functions, and then let it run on all platforms. If we get test failures, we need to adjust the expectations. This works even for ENOMEM situations; see gnulib/tests/test-fprintf-posix2.{c,sh} But it is, admittedly, quite some effort to write and maintain such a test. Bruno