From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0CAADC54E65 for ; Thu, 22 May 2025 22:23:01 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [45.14.194.44]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 626B26020D; Fri, 23 May 2025 00:22:49 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 626B26020D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1747952579; bh=hKwurjCrsZMKgQpTJLebTZlAT90rg6DLftSjusL0jWc=; h=From:To:In-Reply-To:References:Subject:Date:List-Id:List-Archive: List-Help:List-Owner:List-Post:List-Subscribe:List-Unsubscribe: From; b=PvddjajKAaEy32ymii+Gc7HepGE7ow3x0Tg9rBwY0jWf1mTx38b/PQYVOkj2zUEik oaKzMAL0UyKT+ShR8kdXcOdCK+4QWqDYGOl76GhGniVmIDfWfrwD75aXI2/CCnO6+l 45CmltQ+o7gkuTGxNWTqihPyR5IHAmHiRrpEspdQ= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 884C2F805C7; Fri, 23 May 2025 00:22:23 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 76D9BF805B6; Fri, 23 May 2025 00:22:23 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8FB85F8057F; Fri, 23 May 2025 00:22:20 +0200 (CEST) Received: from webhooks-bot.alsa-project.org (vmi2259423.contaboserver.net [45.14.194.44]) by alsa1.perex.cz (Postfix) with ESMTP id C5ADAF80568 for ; Fri, 23 May 2025 00:22:18 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C5ADAF80568 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit From: GitHub issues - edited To: alsa-devel@alsa-project.org Message-Id: <1841f99283587b00-webhooks-bot@alsa-project.org> In-Reply-To: <1841f99283422d00-webhooks-bot@alsa-project.org> References: <1841f99283422d00-webhooks-bot@alsa-project.org> Subject: snd_config_imul always produces a zero result. Date: Fri, 23 May 2025 00:22:20 +0200 (CEST) Message-ID-Hash: RX3NCFR26P3ZK6FTL6HK2WTU3MQGMVDP X-Message-ID-Hash: RX3NCFR26P3ZK6FTL6HK2WTU3MQGMVDP X-MailFrom: github@alsa-project.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: alsa-project/alsa-lib issue #456 was edited from shanekirk: The config function snd_config_imul always produces a zero result. This is because it delegates to snd_func_iops() to perform the iterative multiplication, which always initializes its result value to zero. Then it iteratively multiplies-assigns result against each integer in the params array, which _always_ produces zero. This breaks any configuration that leans on "`@func imul`". This can be demonstrated using this snippet of configuration... ``` test_fn { @func imul integers [2 4 6] } ``` ...or this source code... ``` int main(int argc, char **argv) { snd_config_t *pConfig = NULL; snd_config_top(&pConfig); /** * Setting up... * test_fn * { * @func imul * integers [2 4 6] * } */ snd_config_t *pFnCS = NULL; snd_config_make_compound(&pFnCS, "test_fn", 0); snd_config_add(pConfig, pFnCS); snd_config_t *pFn = NULL; snd_config_imake_string(&pFn, "@func", "imul"); snd_config_add(pFnCS, pFn); snd_config_t *pFnParams = NULL; snd_config_make_compound(&pFnParams, "integers", 0); snd_config_add(pFnCS, pFnParams); snd_config_t *pFnInt = NULL; snd_config_imake_integer(&pFnInt, "0", 2); snd_config_add(pFnParams, pFnInt); snd_config_imake_integer(&pFnInt, "1", 4); snd_config_add(pFnParams, pFnInt); snd_config_imake_integer(&pFnInt, "2", 6); snd_config_add(pFnParams, pFnInt); /** * Evaluating... */ snd_config_evaluate(pFnCS, pConfig, NULL, NULL); assert(snd_config_get_type(pFnCS) == SND_CONFIG_TYPE_INTEGER); long result = 0; snd_config_get_integer(pFnCS, &result); assert(result == 48); // ** FAILS because result is always zero! ** snd_config_delete(pConfig); return 0; } ``` Note: If you replace "imul" above with "iadd" in either example, you'll get the result from iadd that you'd expect. Incidentally, from the history, it would appear that "imul" has never worked correctly since it was introduced all those years ago. So if any configuration truly depended on this feature, it would have always been broken too. Issue URL : https://github.com/alsa-project/alsa-lib/issues/456 Repository URL: https://github.com/alsa-project/alsa-lib