https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110229
Bug ID: 110229
Summary: Segment fault on git clone
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: larry9 at ffdlr dot com
Target Milestone: ---
Created attachment 55312
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55312&action=edit
Where gdb was at the segfault
The file is initializing a very large vector. An array doesn't cause the
segment fault. It needs to be compiled -O1 too, -O0 doesn't segfault. The file
needs some 12GiB to compile and took 5 hours with the debug cc1plus to get to
the fault. It also takes more or less entries between my machines and versions.
I found this with v11.3 under Ubuntu 22.04 but I did a git clone and compiled
with -O0 -ggdb to get the trace starting like
/net/larry/bin64/g++-git-dbg/libexec/gcc/x86_64-linux-gnu/14.0.0/cc1plus -quiet
-imultiarch x86_64-linux-gnu -D_GNU_SOURCE bug.sh.cpp -quiet -dumpbase
bug.sh.cpp -dumpbase-ext .cpp -mtune=generic -march=x86-64 -O1 -o /tmp/bug.sh.s
#0 0x0000000000c45f4c in gt_ggc_mx_lang_tree_node (x_p=0x7ffcef0f18a0) at
./gt-cp-tree.h:104
#1 0x0000000000c466fd in gt_ggc_mx_lang_tree_node (x_p=<optimized out>) at
./gt-cp-tree.h:494
#2 0x0000000000c466fd in gt_ggc_mx_lang_tree_node (x_p=<optimized out>) at
./gt-cp-tree.h:494
#3 0x0000000000c466fd in gt_ggc_mx_lang_tree_node (x_p=<optimized out>) at
./gt-cp-tree.h:494
I have included the gdb output as an attachment
The code is too large to be an attachment. It could easily be generated by a
script, but I don't know the rules on that one.
typedef unsigned long long int size_t;
class psuedo_vector {
public:
~psuedo_vector() {
delete[] data_;
}
psuedo_vector(size_t sz) {
data_ = new int[sz];
}
int& operator[] (size_t index) {
return data_[index];
}
private:
int* data_;
};
psuedo_vector V(2673938);
void
init_v()
{
V[19]=19;
V[20]=20;
...
V[2589823]=2589823;
V[2589824]=2589824;
}