From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 40306489A7 for ; Fri, 22 Dec 2023 09:50:01 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2DA6B68D2B2; Fri, 22 Dec 2023 11:50:00 +0200 (EET) Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AEFC568D184 for ; Fri, 22 Dec 2023 11:49:53 +0200 (EET) Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-50e3295978aso2168967e87.1 for ; Fri, 22 Dec 2023 01:49:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=martin-st.20230601.gappssmtp.com; s=20230601; t=1703238593; x=1703843393; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=p6m7NAvFCoXBKTSyZfTtVgabr/PNJTdPSQZQjIfqjn4=; b=UFvPqO9M+hyUxEme2LwElYYB7+NWQCfeTdCT0LLE7aTn9BVQ/TWewsqfj9p0e2p7AC OJ2ZGTWdlXQYVeFz+59bfC4+XlnvoyzKpuKL/eV4tU3t4CM3p7Ns0RcjAE6rg5RFwfG/ DMZQWs5iYIf43ZESQF87XtDFUQRC5f1DuIbdgIp/I7d5P9DmstTv/PpEOK0J8GMJc6N0 YBUSWuigxs7hYKCVRrQLJgshzmKRRwbf8PuMfrGyWfQd6rNvAzgJaMJvimnukK4owqdr 3I/ueJc3+Ot02vCBaTU704tvHukA6/DrpNX/MrXuMi3pvUf0hoI9su+ZkGyKp+FkwKLo c5JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703238593; x=1703843393; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=p6m7NAvFCoXBKTSyZfTtVgabr/PNJTdPSQZQjIfqjn4=; b=h8HRrrYPZ/fVg4OsPG2ASnAVofY3OGs3Xr3qyry3T+XR0GaJYxi1c/7SLqI5hJBGhQ rO0V9GulGK7WXCjgH+r6mrxS80iiaQM6yo/s8jt2Dq+hTfCiSE50GTVReP45/NbdKSeg qgItfy1abBvjX5VDA1FLV+3vss79JAEBoX2kiJD/Q+sQCsJMGgiKCCmHGP1sgjSjl+Y0 x3Bk1W1nMIzeONLaU/Jh/rnAalwmyXTHv5hzMtzLpUmDo8Afl03uLtxJ3+dLxE3/Eu/y zPwicUbOkh2AsUA3kiLOesUdACuTkRYCHEcqJFmgUlvVYLNDvI2lgi+OTJ32P3JJel4b ZDnA== X-Gm-Message-State: AOJu0YwvOBnQiet5P0SzdSlhS2mJOuOLCtVUtPPf1juNL2kcIXiOkzMQ spWR+KsGnXcBE6l9dEQZtCJViSR8L0T0ZGegD81HXmBZ4fSc X-Google-Smtp-Source: AGHT+IHyW9zXh6SSt2hCSxlRxIZYWjFANsn8Zxho4IgCNqkLe6+b2n1a1UksYqB2KNuEXDlFkRHRcg== X-Received: by 2002:a05:6512:474:b0:50e:6910:496e with SMTP id x20-20020a056512047400b0050e6910496emr408510lfd.28.1703238592676; Fri, 22 Dec 2023 01:49:52 -0800 (PST) Received: from localhost (host-97-144.parnet.fi. [77.234.97.144]) by smtp.gmail.com with ESMTPSA id b9-20020a056512070900b0050cc8bda3a6sm499698lfs.238.2023.12.22.01.49.52 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 22 Dec 2023 01:49:52 -0800 (PST) From: =?UTF-8?q?Martin=20Storsj=C3=B6?= To: ffmpeg-devel@ffmpeg.org Date: Fri, 22 Dec 2023 11:49:51 +0200 Message-Id: <20231222094951.95249-1-martin@martin.st> X-Mailer: git-send-email 2.39.3 (Apple Git-145) MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] checkasm: Fix the takdsp tests X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: For memcpy and memcmp, we need to multiply by the element size, otherwise we're copying and comparing only a fraction of the buffer. For decorrelate_sr, the buffer p1 is the one that is mutated; copy and check p1 instead of p2. For decorrelate_sm, both buffers are mutated, so copy and check both of them. For decorrelate_sm, the memcpy initialization of p1 and p1_2 was reversed - p1 is filled with randomize, but then memcpy copies from p1_2 to p1. As p1_2 is uninitialized at this point, clang concluded that the copy was bogus and omitted it entirely, triggering failures in this test on x86 (where there was an existing assembly implementation to test). --- tests/checkasm/takdsp.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/tests/checkasm/takdsp.c b/tests/checkasm/takdsp.c index 495b7242c5..3aecee1f72 100644 --- a/tests/checkasm/takdsp.c +++ b/tests/checkasm/takdsp.c @@ -44,12 +44,12 @@ static void test_decorrelate_ls(TAKDSPContext *s) { randomize(p1, BUF_SIZE); randomize(p2, BUF_SIZE); - memcpy(p2_2, p2, BUF_SIZE); + memcpy(p2_2, p2, BUF_SIZE * sizeof(*p2)); call_ref(p1, p2, BUF_SIZE); call_new(p1, p2_2, BUF_SIZE); - if (memcmp(p2, p2_2, BUF_SIZE) != 0){ + if (memcmp(p2, p2_2, BUF_SIZE * sizeof(*p2)) != 0) { fail(); } @@ -65,17 +65,17 @@ static void test_decorrelate_sr(TAKDSPContext *s) { if (check_func(s->decorrelate_sr, "decorrelate_sr")) { LOCAL_ALIGNED_32(int32_t, p1, [BUF_SIZE]); + LOCAL_ALIGNED_32(int32_t, p1_2, [BUF_SIZE]); LOCAL_ALIGNED_32(int32_t, p2, [BUF_SIZE]); - LOCAL_ALIGNED_32(int32_t, p2_2, [BUF_SIZE]); randomize(p1, BUF_SIZE); + memcpy(p1_2, p1, BUF_SIZE * sizeof(*p1)); randomize(p2, BUF_SIZE); - memcpy(p2_2, p2, BUF_SIZE); call_ref(p1, p2, BUF_SIZE); - call_new(p1, p2_2, BUF_SIZE); + call_new(p1_2, p2, BUF_SIZE); - if (memcmp(p2, p2_2, BUF_SIZE) != 0){ + if (memcmp(p1, p1_2, BUF_SIZE * sizeof(*p1)) != 0) { fail(); } @@ -96,14 +96,15 @@ static void test_decorrelate_sm(TAKDSPContext *s) { LOCAL_ALIGNED_32(int32_t, p2_2, [BUF_SIZE]); randomize(p1, BUF_SIZE); - memcpy(p1, p1_2, BUF_SIZE); + memcpy(p1_2, p1, BUF_SIZE * sizeof(*p1)); randomize(p2, BUF_SIZE); - memcpy(p2_2, p2, BUF_SIZE); + memcpy(p2_2, p2, BUF_SIZE * sizeof(*p2)); call_ref(p1, p2, BUF_SIZE); call_new(p1_2, p2_2, BUF_SIZE); - if (memcmp(p2, p2_2, BUF_SIZE) != 0){ + if (memcmp(p1, p1_2, BUF_SIZE * sizeof(*p1)) != 0 || + memcmp(p2, p2_2, BUF_SIZE * sizeof(*p2)) != 0) { fail(); } -- 2.39.3 (Apple Git-145) _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".