g++-8 in disco is broken with libstdc++6 from gcc9 and libstdc++fs
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gcc |
Invalid
|
Medium
|
|||
gcc-8 (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Bionic |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
There is a significant incompatibility here which leaves the default C++ compiler broken with C++17 std::filesystem usage. Unfortunately, there isn't an obvious workaround since there's only one libstdc++6 package, and it's using the non-default and unreleased GCC9 version of libstdc++, making it impossible to use the compatible GCC8 version of the library.
% cat testpath.cpp
#include <filesystem>
int main()
{
std::
}
g++-9 -std=c++17 -lstdc++fs -g3 -o testpath testpath.cpp
% ./testpath
% g++-8 -std=c++17 -lstdc++fs -g3 -o testpath testpath.cpp
% ./testpath
zsh: segmentation fault (core dumped) ./testpath
% gdb testpath
GNU gdb (Ubuntu 8.2.91.
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://
Find the GDB manual and other documentation resources online at:
<http://
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from testpath...
(gdb) run
Starting program: /tmp/testpath
Program received signal SIGSEGV, Segmentation fault.
0x000055555555649b in std::vector<
567 std::_Destroy(
(gdb) bt
#0 0x000055555555649b in std::vector<
#1 0x0000555555556314 in std::filesystem
at /usr/include/
#2 0x0000555555556f5c in std::filesystem
at /usr/include/
#3 0x0000555555556f77 in std::_Destroy<
at /usr/include/
#4 0x0000555555556e27 in std::_Destroy_
__first=0x3, __last=0x0) at /usr/include/
#5 0x0000555555556a98 in std::_Destroy<
at /usr/include/
#6 0x00005555555567a9 in std::_Destroy<
#7 0x00005555555564b1 in std::vector<
at /usr/include/
#8 0x0000555555556314 in std::filesystem
at /usr/include/
#9 0x0000555555556230 in main () at testpath.cpp:5
(gdb) quit
A debugging session is active.
Inferior 1 [process 2414] will be killed.
Quit anyway? (y or n) y
affects: | gcc-7 (Ubuntu) → gcc-8 (Ubuntu) |
Changed in gcc: | |
importance: | Unknown → Medium |
status: | Unknown → Invalid |
Changed in gcc-8 (Ubuntu): | |
status: | Incomplete → Triaged |
#include <filesystem>
int main() { filesystem: :path p = "foo";
std::
}
g++ -g --std=c++17 path.cpp
./a.out
Segmentation fault (core dumped)
g++ --version
g++ (Ubuntu 8.3.0-6ubuntu1) 8.3.0
uname -a generic #201904030534 SMP Wed Apr 3 05:36:14 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Linux x2 5.0.6-050006-
Ubuntu 19.04.
Core was generated by `./a.out'. std::filesystem ::__cxx11: :path:: _Cmpt, std::allocator< std::filesystem ::__cxx11: :path:: _Cmpt> >::~vector (this=0x23, __in_chrg= <optimized out>) at /usr/include/ c++/8/bits/ stl_vector. h:567 this->_ M_impl. _M_start, this->_ M_impl. _M_finish, std::filesystem ::__cxx11: :path:: _Cmpt, std::allocator< std::filesystem ::__cxx11: :path:: _Cmpt> >::~vector (this=0x23, __in_chrg= <optimized out>) at /usr/include/ c++/8/bits/ stl_vector. h:567 ::__cxx11: :path:: ~path (this=0x3, __in_chrg= <optimized out>) at /usr/include/ c++/8/bits/ fs_path. h:208 ::__cxx11: :path:: _Cmpt:: ~_Cmpt (this=0x3, __in_chrg= <optimized out>) at /usr/include/ c++/8/bits/ fs_path. h:643 std::filesystem ::__cxx11: :path:: _Cmpt> (__pointer=0x3) at /usr/include/ c++/8/bits/ stl_construct. h:98 aux<false> ::__destroy< std::filesystem ::__cxx11: :path:: _Cmpt*> (__first=0x3, __last=0x0) at /usr/include/ c++/8/bits/ stl_construct. h:108 std::filesystem ::__cxx11: :path:: _Cmpt*> (__first=0x3, __last=0x0) at /usr/include/ c++/8/bits/ stl_construct. h:137 std::filesystem ::__cxx11: :path:: _Cmpt*, std::filesystem ::__cxx11: :path:: _Cmpt> (__first=0x3, __last=0x0) at /usr/include/ c++/8/bits/ stl_construct. h:206 std::filesystem ::__cxx11: :path:: _Cmpt, std::allocator< std::filesystem ::__cxx11: :path:: _Cmpt> >::~vector (this=0x7ffe3ad 201d0, __in_chrg= <optimized out>) c++/8/bits/ stl_vector. h:567 ::__cxx11: :path:: ~path (this=0x7ffe3ad 201b0, __in_chrg= <optimized out>) at /usr/include/ c++/8/bits/ fs_path. h:208
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x000055c2ac25149b in std::vector<
567 std::_Destroy(
(gdb) bt
#0 0x000055c2ac25149b in std::vector<
#1 0x000055c2ac251314 in std::filesystem
#2 0x000055c2ac251f5c in std::filesystem
#3 0x000055c2ac251f77 in std::_Destroy<
#4 0x000055c2ac251e27 in std::_Destroy_
#5 0x000055c2ac251a98 in std::_Destroy<
#6 0x000055c2ac2517a9 in std::_Destroy<
#7 0x000055c2ac2514b1 in std::vector<
at /usr/include/
#8 0x000055c2ac251314 in std::filesystem
#9 0x000055c2ac251230 in main () at path.cpp:4