range-v3 icon indicating copy to clipboard operation
range-v3 copied to clipboard

Ubuntu 20.10 g++10 -std=c++20 1-line crash

Open keryell opened this issue 3 years ago • 7 comments

Bug pointing down to 1 line with this /tmp/a.cpp:

#include <range/v3/all.hpp>
g++-10 -std=c++20 /tmp/a.cpp                                      
In file included from /usr/include/range/v3/view.hpp:25,
                 from /usr/include/range/v3/all.hpp:25,
                 from /tmp/a.cpp:1:
/usr/include/range/v3/view/cartesian_product.hpp: In substitution of ‘template<class ... Views> template<bool IsConst_> template<class T> using constify_if = meta::const_if_c<IsConst_, T> [with T = ranges::cartesian_product_view<Views>; bool IsConst_ = IsConst_; Views = {Views ...}]’:
/usr/include/range/v3/view/cartesian_product.hpp:154:47:   required from here
/usr/include/range/v3/view/cartesian_product.hpp:154:47: internal compiler error: Segmentation fault
  154 |             constify_if<cartesian_product_view> * view_;
      |                                               ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-10/README.Bugs> for instructions.

g++ --version
g++ (Ubuntu 10.2.0-13ubuntu1) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.

Either the Ubuntu package librange-v3-dev or the master branch is crashing g++.

Since I am using the library from git usually, I guess it is simpler to have a work-around in range-v3 than in g++. I have not tried to compile myself the latest g++... There is no crash with C++17 mode but I use some C++20 features.

Thanks.

keryell avatar Oct 27 '20 00:10 keryell

I think I've just hit this as well.

$ g++ --version
g++ (Debian 10.2.0-9) 10.2.0

Std version: -std=c++2a Range-v3 versions: attempted with a few different versions, including 0.11.0 (latest tag)

../../extern/range-v3/include/range/v3/view/concat.hpp: In substitution of ‘template<class ... Rngs> template<bool IsConst> template<class T> using constify_if = meta::const_if_c<IsConst, T> [with T = ranges::concat_view<Rngs>; bool IsConst = IsConst; Rngs = {Rngs ...}]’:
../../extern/range-v3/include/range/v3/view/concat.hpp:88:58:   required from here
../../extern/range-v3/include/range/v3/view/concat.hpp:88:58: internal compiler error: Segmentation fault
   88 |             using concat_view_t = constify_if<concat_view>;

no-more-secrets avatar Nov 02 '20 22:11 no-more-secrets

Please file this bug with gcc if you haven't already. A compiler crash is always a compiler bug.

It's possible a workout exists. I'm not likely to have time to hunt for one though. 😞

ericniebler avatar Nov 02 '20 22:11 ericniebler

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96720

wnts avatar Nov 05 '20 20:11 wnts

gcc.gnu.org/bugzilla/show_bug.cgi?id=96720

Thanks for digging into this. Actually I was not able to trigger the bug by playing around https://godbolt.org/z/oM7v41 Perhaps it happens only withrange-v3 0-11-0 Version 0.11.0 "Thanks, ISO" & g++ (Debian 10.2.0-16) 10.2.0 coming with Ubuntu 20.10?

keryell avatar Nov 06 '20 06:11 keryell

I've observed this bug with multiple versions of range-v3, but not all builds of g++ 10.2.0. When I build my own version of g++ 10.2.0 I do not hit the issue; it only seems to happen with the g++ on the Debian/Ubuntu system.

no-more-secrets avatar Nov 06 '20 10:11 no-more-secrets

So it looks like it is somehow solved in a more recent environment. Just wait for the next version to land into Debian/unstable and this is caught by Ubuntu? Honestly I do not really care about either using clang++ or g++, I just want both to work for the fault-tolerance and alternative error/warning diagnostics. The only difficulty for me is that I have not found any precompiled g++ distribution from master branch for Debian/Ubuntu, equivalent to https://apt.llvm.org/

keryell avatar Nov 06 '20 19:11 keryell

I have the same issue on fedora build.

bogado avatar Nov 06 '20 21:11 bogado