From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 91843A04F2 for ; Wed, 4 Dec 2019 22:20:04 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 52B951BE83; Wed, 4 Dec 2019 22:20:04 +0100 (CET) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by dpdk.org (Postfix) with ESMTP id 3F60F1BE83 for ; Wed, 4 Dec 2019 22:20:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575494402; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CAb4DhT4NFxalhudLNz1yisrUNC5gwCAGRcE6KAE+8s=; b=iHhBF/0M1eBuN1ZJCL2AWRWExochCGVoJGP4tumiMivXeMdXeYdw3b5/0eFdp0KPagwc9k usrjw7Xvz5JKbpt4oq/aGs+sxaDpjjfc0cQoLxw7vuaIB859U6ZN+LC3gineTlALXPK6lJ WefPBIFlqPHk6/G2Pt7qtxfs9/W8fb0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-239-2USyujtsOeKCn76TwQck5Q-1; Wed, 04 Dec 2019 16:20:01 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4141718C35A0; Wed, 4 Dec 2019 21:20:00 +0000 (UTC) Received: from dhcp-25.97.bos.redhat.com (unknown [10.18.25.127]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 51AAB1001920; Wed, 4 Dec 2019 21:19:57 +0000 (UTC) From: Aaron Conole To: David Marchand Cc: dev@dpdk.org, stable@dpdk.org References: <20191204205241.5691-1-david.marchand@redhat.com> Date: Wed, 04 Dec 2019 16:19:56 -0500 In-Reply-To: <20191204205241.5691-1-david.marchand@redhat.com> (David Marchand's message of "Wed, 4 Dec 2019 21:52:41 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: 2USyujtsOeKCn76TwQck5Q-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-stable] [PATCH] test/common: fix log2 check X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" David Marchand writes: > We recently started to get random failures on the common_autotest ut with > clang on Ubuntu 16.04.6. > > Example: https://travis-ci.com/DPDK/dpdk/jobs/263177424 > > Wrong rte_log2_u64(0) val 0, expected ffffffff > Test Failed > > The ut passes 0 to log2() to get an expected value. > > Quoting log2 / log(3) manual: > If x is zero, then a pole error occurs, and the functions return > -HUGE_VAL, -HUGE_VALF, or -HUGE_VALL, respectively. > > rte_log2_uXX helpers handle 0 as a special value and return 0. > Let's have dedicated tests for this case. > > Fixes: 05c4345ef5c2 ("test: add unit test for integer log2 function") > Cc: stable@dpdk.org > > Signed-off-by: David Marchand > --- Acked-by: Aaron Conole Somethings that concern me: 1. A log2(0) should probably be an undetermined value, but this effectively makes log2(0) =3D=3D log2(1) so that if anyone uses these for some mathematical work, it will have an exceptional behavior. I know it's documented from a programmer perspective, but I am all for documenting the mathematical side effect as well. 2. Why hasn't this been complaining for so long? Or has it and we just haven't noticed? Were some compiler flags changed recently? (maybe -funsafe-math was always set or something?) -Aaron