Message ID | 20241024072645.634748-1-william.tsai@sifive.com |
---|---|
State | New |
Headers |
Return-Path: <newlib-bounces~patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6636A3858C3A for <patchwork@sourceware.org>; Thu, 24 Oct 2024 07:28:36 +0000 (GMT) X-Original-To: newlib@sourceware.org Delivered-To: newlib@sourceware.org Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by sourceware.org (Postfix) with ESMTPS id 429153858C98 for <newlib@sourceware.org>; Thu, 24 Oct 2024 07:28:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 429153858C98 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=sifive.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=sifive.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 429153858C98 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::1032 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1729754896; cv=none; b=bomdxOksPWQbYaafpqzlyrXdCcvrHJXzUyyPmELiVpemv8Zn+1zKSGex+PQ41IMjcZ1k/HFO3t5I667Q/c6Ms56zitaA7y1RuQQ0kgWGWBtRoWIgcS8ZVG39MnZmMzNLy94L6IVDEDl6dndx2p4QeV5E8vM4M/vngrrVkSPmJxU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1729754896; c=relaxed/simple; bh=IwoebBMa443N89kskSSlxlUmvXgh1PJf5OkzZOZmadU=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=C6z+/lAG0Yw1y6CPYn9lMiAKERWRhB+OFBv6Tfg64uENCcx0GGf/jzGsOi+lfDDPh0GutiqOUEuQsYgIM2C2ClVY7LOFzXCDt64cDHq/UUKxXfPk2V3JaYuuL3lcxUzHZYOqzq2vbpm91GJxpmxTbmUx/yfyhm5uYaxa50UBL2Q= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pj1-x1032.google.com with SMTP id 98e67ed59e1d1-2e18293a5efso448196a91.3 for <newlib@sourceware.org>; Thu, 24 Oct 2024 00:28:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1729754889; x=1730359689; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=qxSEURU3M9h7cXbjRc+WLvclkHgs4wj0VBhBIeSYW0Q=; b=aVbsFLPXmlUgXLa5Ocy5ctoBhw899iqrfoRCty0NquGO3AyDaMBD56BUe+aV+sRrx9 r7bD3ML930hc2Kx9PrgmrbxmA2l5BPWI7YYpiK/Z/NM9DZl+oy7a8QKXews7D45ZzkLB fxCq/uykZSsEFHPrk373UHj0WYjwXM5qlu7tlUSSZh4D3s6ZrK2NgL3XEoew8s0PWMsm 9JClhFdppT8Vt9kBqK9saGkH4gOGbvDvRF6ewuVjGpDk4pH2yyltgKydRjstzC3sNsO2 iAhG4qg3386ZnxPviIY5NbmqFqq+3+FL+r7m87PiPT9hWfdSYTaPlZQp6GjrC1wQ4rJI phQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729754889; x=1730359689; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=qxSEURU3M9h7cXbjRc+WLvclkHgs4wj0VBhBIeSYW0Q=; b=jFEHUrcRuxm5/+HCZWpixDN05Icdvi1WeeRJkZOWaIvPJDpsIDZWJdHMuGh+0IKOV5 MJLBgJ6zHZYedasW61IEAwDt+Fk5gcS6dIwvnJOuMAFCnzJMbHG0cE8thFbe6hr9b5z9 rXvOVLPhrh9Gxw3W/clcsxNylra/cIikTVNB6yJAVI54z7/20yrJTTg+I+j41/H+5mhM ka9bLkNejfCGgP5p5gzRRU6T56oa7kzCvaakaCDkdHEDRGgVJOKd5RJigBdUwVH1Pv5x IgEWcgTNBlWs/fYpa7a1Jm8KkpW06Ud6z04egoJ+VPokMz+XnFYP0TlrmwDC0+wY30NT oK4w== X-Gm-Message-State: AOJu0YwLwHrvReq97hA9WDrlFfVX8kzwxKQgXp0VReTBvQL0/cI2SUaZ EsXhis7k2CadWVKfinsGoMIsZ3kMdzSQRCzC3ZVbcFgif1R42+7ncUac+0T2PryfNYx+aeboMne 7T4xJq2yYzeAl2iCjdkOty4+sfjidpAvPh24jiYPSn4ZiAwymRUQRqunR58pUynmwX8MSRKko0V d29On5zT6zU6DY6atoTcrzHXyN+8STqR+4v/zVbY7O/HA= X-Google-Smtp-Source: AGHT+IHsaFJB2XrdQRbofOhxUbmXkUC49nwZJIovlkSo5Q2G/Ve1+LRDFUwfmNNVY4/MOlULayb0kA== X-Received: by 2002:a17:90b:4c8f:b0:2e2:da6e:8807 with SMTP id 98e67ed59e1d1-2e77f729622mr1043972a91.26.1729754888718; Thu, 24 Oct 2024 00:28:08 -0700 (PDT) Received: from sw07.internal.sifive.com ([4.53.31.132]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e77e4e3febsm745978a91.26.2024.10.24.00.28.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2024 00:28:08 -0700 (PDT) From: William Tsai <william.tsai@sifive.com> To: newlib@sourceware.org, kito.cheng@gmail.com Cc: William Tsai <william.tsai@sifive.com> Subject: [PATCH] newlib: libm: Fix RISCV feraiseexcept return value when success Date: Thu, 24 Oct 2024 00:26:46 -0700 Message-Id: <20241024072645.634748-1-william.tsai@sifive.com> X-Mailer: git-send-email 2.37.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Newlib mailing list <newlib.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/newlib>, <mailto:newlib-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/newlib/> List-Post: <mailto:newlib@sourceware.org> List-Help: <mailto:newlib-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/newlib>, <mailto:newlib-request@sourceware.org?subject=subscribe> Errors-To: newlib-bounces~patchwork=sourceware.org@sourceware.org |
Series |
newlib: libm: Fix RISCV feraiseexcept return value when success
|
|
Commit Message
William Tsai
Oct. 24, 2024, 7:26 a.m. UTC
According to the document, feraiseexcept should return 0 when exception is raised succesfully. The return statement is missing here causing it always return a non-zero value even when success. --- newlib/libm/machine/riscv/feraiseexcept.c | 1 + 1 file changed, 1 insertion(+)
Comments
On Oct 24 00:26, William Tsai wrote: > According to the document, feraiseexcept should return 0 when exception > is raised succesfully. The return statement is missing here causing it > always return a non-zero value even when success. > --- > newlib/libm/machine/riscv/feraiseexcept.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/newlib/libm/machine/riscv/feraiseexcept.c b/newlib/libm/machine/riscv/feraiseexcept.c > index 817fa6274..99bacd556 100644 > --- a/newlib/libm/machine/riscv/feraiseexcept.c > +++ b/newlib/libm/machine/riscv/feraiseexcept.c > @@ -64,6 +64,7 @@ int feraiseexcept(int excepts) > /* Set the requested exception flags */ > > asm volatile("csrs fflags, %0" : : "r"(excepts)); > + return 0; > > /* Per 'feraiseexcept.html: > * "If the argument is zero or if all the specified exceptions were > -- > 2.37.1 What about the return statement in line 85, following the longish comment? Corinna
The return in line 85 outside the macro, which is used when hardware does not have floating point exception support. The added return is inside the macro after the exception is raised. On Thu, Oct 24, 2024 at 4:22 PM Corinna Vinschen <vinschen@redhat.com> wrote: > On Oct 24 00:26, William Tsai wrote: > > According to the document, feraiseexcept should return 0 when exception > > is raised succesfully. The return statement is missing here causing it > > always return a non-zero value even when success. > > --- > > newlib/libm/machine/riscv/feraiseexcept.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/newlib/libm/machine/riscv/feraiseexcept.c > b/newlib/libm/machine/riscv/feraiseexcept.c > > index 817fa6274..99bacd556 100644 > > --- a/newlib/libm/machine/riscv/feraiseexcept.c > > +++ b/newlib/libm/machine/riscv/feraiseexcept.c > > @@ -64,6 +64,7 @@ int feraiseexcept(int excepts) > > /* Set the requested exception flags */ > > > > asm volatile("csrs fflags, %0" : : "r"(excepts)); > > + return 0; > > > > /* Per 'feraiseexcept.html: > > * "If the argument is zero or if all the specified exceptions were > > -- > > 2.37.1 > > What about the return statement in line 85, following the longish comment? > > > Corinna > >
On Oct 24 16:27, William Tsai wrote: > The return in line 85 outside the macro, which is used when hardware does > not have floating point exception support. The added return is inside the > macro after the exception is raised. Ok, I defer to the RISCV guys. The comment following the asm statement sounds weirdly like the non-0 return value is by choice. Kito, can you please chime in here? Thanks, Corinna > > On Thu, Oct 24, 2024 at 4:22 PM Corinna Vinschen <vinschen@redhat.com> > wrote: > > > On Oct 24 00:26, William Tsai wrote: > > > According to the document, feraiseexcept should return 0 when exception > > > is raised succesfully. The return statement is missing here causing it > > > always return a non-zero value even when success. > > > --- > > > newlib/libm/machine/riscv/feraiseexcept.c | 1 + > > > 1 file changed, 1 insertion(+) > > > > > > diff --git a/newlib/libm/machine/riscv/feraiseexcept.c > > b/newlib/libm/machine/riscv/feraiseexcept.c > > > index 817fa6274..99bacd556 100644 > > > --- a/newlib/libm/machine/riscv/feraiseexcept.c > > > +++ b/newlib/libm/machine/riscv/feraiseexcept.c > > > @@ -64,6 +64,7 @@ int feraiseexcept(int excepts) > > > /* Set the requested exception flags */ > > > > > > asm volatile("csrs fflags, %0" : : "r"(excepts)); > > > + return 0; > > > > > > /* Per 'feraiseexcept.html: > > > * "If the argument is zero or if all the specified exceptions were > > > -- > > > 2.37.1 > > > > What about the return statement in line 85, following the longish comment? > > > > > > Corinna > > > >
diff --git a/newlib/libm/machine/riscv/feraiseexcept.c b/newlib/libm/machine/riscv/feraiseexcept.c index 817fa6274..99bacd556 100644 --- a/newlib/libm/machine/riscv/feraiseexcept.c +++ b/newlib/libm/machine/riscv/feraiseexcept.c @@ -64,6 +64,7 @@ int feraiseexcept(int excepts) /* Set the requested exception flags */ asm volatile("csrs fflags, %0" : : "r"(excepts)); + return 0; /* Per 'feraiseexcept.html: * "If the argument is zero or if all the specified exceptions were