Inconsistent segmentation fault in GCC
Alessandro Baretta
alexbaretta@gmail.com
Thu Dec 23 01:06:08 GMT 2021
Hello GCC hackers, and thank you very much for your precious work here.
I've been observing somewhat random GCC segfaults in my C++ 20
codebase for a while. By "random" I mean that if I rerun the cmake
build after a failure, 75% out of the time it will succeed, and it
might fail again the next time I try running the build. I have every
reason to believe that the issue is not with my code because:
1) At the second (or more rarely third) attempt at running the build,
it succeeds.
2) Clang does not segfault on the same codebase, and indeed produces
correct code.
The codebase is fairly large and heavily templatized, so I know that
the the compiler allocates a seemingly inordinate amount of memory
(using top, I've seen it reach a RES size of 1.6GB and a VIRT size of
4GB), so I initially attributed the segfaults to lack of enough memory
on my computer (16GB, with chrome running...). Now I turned on swap
(32GB), and I see that even when gcc is running, there is plenty of
available memory, so this is not a plausible cause.
The possibility of a hardware glitch in my system also does not hold
much water, as neither clang nor any other piece of software seems to
exhibit any instability.
It'd be great if I could get some guidance on how to investigate this
issue further. If it were of value to the developers, I'd be happy to
file a bug report, but given the randomness of the issue, I doubt that
they'd be able to reproduce the problem even with a preprocessed file.
What then is my path forward?
Here's some information that might be relevant:
$ cat /etc/debian_version
11.1
$ gcc --version
gcc (Debian 10.2.1-6) 10.2.1 20210110
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Thanks for any help!
--
Alex Baretta
t: 650-383-0227
More information about the Gcc
mailing list