From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vk1-xa2e.google.com (mail-vk1-xa2e.google.com [IPv6:2607:f8b0:4864:20::a2e]) by sourceware.org (Postfix) with ESMTPS id D12683858D1E for ; Tue, 2 May 2023 14:32:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D12683858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-vk1-xa2e.google.com with SMTP id 71dfb90a1353d-44e9f304247so1594190e0c.3 for ; Tue, 02 May 2023 07:32:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683037924; x=1685629924; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=RMcX4Ma2QuR52Ur4jtC2gk3b8LtJHGc+3JLC1qXxnso=; b=Z98u8l5Oj+gWnsKBIpRGveJ6GTkzDIY2Qyf9PTZTTk1U0qeW6e1/iEEAjP1shFszx1 /z4x61vu20zFxtTCSbqnRab9Jdhs/fCWPJBMVn34D6333iEyofPZscXMRQ5ygA64OxvJ eHWPTR5Cza4KsdWU2GUMxO+PxLTomS5sUSDh+6YsK6SWXJ4zK5UwpMiRHE3g3ah+4hGz jQi8MMDHYb1CB0PbPgYYkuZzXr8pF8i8/JzLMQ3iRcmT5PyLnLXN4kLm2bW2yxvQwMN6 AyENE7tRdU/PPwaQrQG+k5FB8UBZsZ/V839EEi3E1zwcZ/FxyW4ZSUuYY8Ssu2vkXKi0 Tqhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683037924; x=1685629924; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RMcX4Ma2QuR52Ur4jtC2gk3b8LtJHGc+3JLC1qXxnso=; b=PtpKwOQLjwmXYlQGvQT+uftWsuSssh1a+3uDRgW94Ao/Hih5yWxPf+5/asnpEPpVWW +Je9AuZq/9oQ7o6zSDHHsl2O27tBLyza6o/5F06s+/wzePlUuidfGqGLs1aQ+EUVb1NL 0jCF6SWztIIFgLIWVDIsUtrnyRxb8B1jAkD+FJZQtmuPOwcyhQeoB5yVLZWEkWtUqpwI 1ftOPxhz1J1wPo5UNBK1DmFiZ9NuMMbL73E++L+ODXgMTodXXuxjzrIxHW/eU8si5Wyx evuwAFIctTXhVI9bhNkWOkxd6X6RQkGaqtZtKVz2lrb7Isd1oXF/v3PlrSZbmiGizn6Q O2AA== X-Gm-Message-State: AC+VfDz9f1eFSaLwAV6uj+mH5FtyAV0p6vOwqW9VHIJu3JW+NpZfeobJ qhjRgtiO9AhqYtsQ6jwhKKz70dHa25g4fwT+Ado= X-Google-Smtp-Source: ACHHUZ7zSCv1gKW+AZudByqF9+5xMe+JoDTvqm7T4tuG1DfYtwFMsGSPkz3vMoe3FW81ffNn8stK69maf0XOt/lJUgM= X-Received: by 2002:a05:6102:a2a:b0:42e:697d:b3c4 with SMTP id 10-20020a0561020a2a00b0042e697db3c4mr56897vsb.31.1683037923815; Tue, 02 May 2023 07:32:03 -0700 (PDT) MIME-Version: 1.0 References: <20230502122155.2576725-1-romain.naour@gmail.com> In-Reply-To: <20230502122155.2576725-1-romain.naour@gmail.com> From: Kito Cheng Date: Tue, 2 May 2023 22:31:52 +0800 Message-ID: Subject: Re: [PATCH] RISC-V: fix build issue with gcc 4.9.x To: Romain Naour Cc: gcc-patches@gcc.gnu.org, kito.cheng@sifive.com, juzhe.zhong@rivai.ai Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi Romain: Pushed to trunk, thanks for catching that, that's definitely should use log2 no matter C++03 or C++11, but I think GCC allows the usage of C++11 according to https://gcc.gnu.org/install/prerequisites.html :P On Tue, May 2, 2023 at 8:22=E2=80=AFPM Romain Naour via Gcc-patches wrote: > > GCC should still build with GCC 4.8.3 or newer [1] > using C++03 by default. But a recent change in > RISC-V port introduced a C++11 feature "std::log2" [2]. > > Use log2 from the C header, without the namespace [3]. > > [1] https://gcc.gnu.org/install/prerequisites.html > [2] https://gcc.gnu.org/git/?p=3Dgcc.git;a=3Dpatch;h=3D7caa1ae5e451e780fb= c4746a54e3f19d4f4304dc > [3] https://stackoverflow.com/questions/26733413/error-log2-is-not-a-memb= er-of-std > > Fixes: > https://gitlab.com/buildroot.org/toolchains-builder/-/jobs/4202276589 > > gcc/ChangeLog: > * config/riscv/genrvv-type-indexer.cc: Use log2 from the C header= , without > the namespace. > > Signed-off-by: Romain Naour > --- > gcc/config/riscv/genrvv-type-indexer.cc | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/gcc/config/riscv/genrvv-type-indexer.cc b/gcc/config/riscv/g= enrvv-type-indexer.cc > index e677b55290c..eebe382d1c3 100644 > --- a/gcc/config/riscv/genrvv-type-indexer.cc > +++ b/gcc/config/riscv/genrvv-type-indexer.cc > @@ -115,9 +115,9 @@ same_ratio_eew_type (unsigned sew, int lmul_log2, uns= igned eew, bool unsigned_p, > if (sew =3D=3D eew) > elmul_log2 =3D lmul_log2; > else if (sew > eew) > - elmul_log2 =3D lmul_log2 - std::log2 (sew / eew); > + elmul_log2 =3D lmul_log2 - log2 (sew / eew); > else /* sew < eew */ > - elmul_log2 =3D lmul_log2 + std::log2 (eew / sew); > + elmul_log2 =3D lmul_log2 + log2 (eew / sew); > > if (float_p) > return floattype (eew, elmul_log2); > -- > 2.34.3 >