[PATCH] RISC-V: fix build issue with gcc 4.9.x

Andrew Pinski pinskia@gmail.com
Wed May 3 00:47:47 GMT 2023


On Tue, May 2, 2023 at 5:38 PM Kito Cheng via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> > >>> 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
> > >> Yes, we should be able to use C++11.  I'd like to get that to C++17 at
> > >> some point, but I think the biggest problem is the desire to support
> > >> bootstrapping on something like centos7/rhel7.
> > >
> > > At least we have auto and range based for loop, I am satisfied with
> > > that enough.
> >
> > Indeed, gcc 4.9 already support C++11 but for some reason std::log2 fail with
> > it. Probably because gcc 4.9 is the last gcc release with C++03 used by default.
> > I wasn't able to reproduce the build issue (without my patch) with gcc 10 or 11.
>
> Anyway I think your fix is reasonable since we include math.h not cmath.h here,
> so use without std:: is rightway, but don't know why it is build-able
> with newer GCC,
> I guess that might be included by some other header indirectly.

No libstdc++ was specifically fixed in GCC 6 to do the correct thing,
see PR 60401 and PR 14608 (r6-6392-g96e19adabc80146648825).

Thanks,
Andrew Pinski

>
> > I'm fine with new prerequisites for the next gcc release, I checked the release
> > note about that. I noticed that all toolchains I've built with gcc 13.1 for
> > other cpu target where successful with the same setup (docker image).
> >
> > Thanks!
> >
> > Best regards,
> > Romain
> >
> > >
> > >
> > >>
> > >> jeff
> >


More information about the Gcc-patches mailing list