public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Kito Cheng <kito.cheng@gmail.com>
To: Romain Naour <romain.naour@gmail.com>
Cc: gcc-patches@gcc.gnu.org, kito.cheng@sifive.com, juzhe.zhong@rivai.ai
Subject: Re: [PATCH] RISC-V: fix build issue with gcc 4.9.x
Date: Tue, 2 May 2023 22:31:52 +0800	[thread overview]
Message-ID: <CA+yXCZAFf8_F8V8Xm+cXTmUXzKbzwzWC_y4Rk8DRAFCG6vdr4A@mail.gmail.com> (raw)
In-Reply-To: <20230502122155.2576725-1-romain.naour@gmail.com>

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 PM Romain Naour via Gcc-patches
<gcc-patches@gcc.gnu.org> 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=gcc.git;a=patch;h=7caa1ae5e451e780fbc4746a54e3f19d4f4304dc
> [3] https://stackoverflow.com/questions/26733413/error-log2-is-not-a-member-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 <romain.naour@gmail.com>
> ---
>  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/genrvv-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, unsigned eew, bool unsigned_p,
>    if (sew == eew)
>      elmul_log2 = lmul_log2;
>    else if (sew > eew)
> -    elmul_log2 = lmul_log2 - std::log2 (sew / eew);
> +    elmul_log2 = lmul_log2 - log2 (sew / eew);
>    else /* sew < eew */
> -    elmul_log2 = lmul_log2 + std::log2 (eew / sew);
> +    elmul_log2 = lmul_log2 + log2 (eew / sew);
>
>    if (float_p)
>      return floattype (eew, elmul_log2);
> --
> 2.34.3
>

  reply	other threads:[~2023-05-02 14:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-02 12:21 Romain Naour
2023-05-02 14:31 ` Kito Cheng [this message]
2023-05-02 15:44   ` Jeff Law
2023-05-02 15:51     ` Kito Cheng
2023-05-02 20:46       ` Romain Naour
2023-05-03  0:37         ` Kito Cheng
2023-05-03  0:47           ` Andrew Pinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+yXCZAFf8_F8V8Xm+cXTmUXzKbzwzWC_y4Rk8DRAFCG6vdr4A@mail.gmail.com \
    --to=kito.cheng@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=juzhe.zhong@rivai.ai \
    --cc=kito.cheng@sifive.com \
    --cc=romain.naour@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).