[Bug c++/126004] ICE/sig11 when using --param=ggc-min-expand=20 --param=ggc-min-heapsize=32768

henri at henrimenke dot de via Gcc-bugs <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126004

Henri Menke <henri at henrimenke dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |henri at henrimenke dot de

--- Comment #1 from Henri Menke <henri at henrimenke dot de> ---
Created attachment 65146
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65146&action=edit
c++: fix use-after-free of "declare variant" context selector

This bug is fairly hard to reproduce. In fact, I encountered what I believe to
be the same issue in a complex multi-project setup. Building GCC with
--enable-checking=yes,extra gave me the following error message.

tree check: expected tree_list, have ggc_freed in
omp_get_context_selector_list, at omp-general.cc:2691

So a tree_list is garbage-collected while still being in use, leading to a
use-after-free issue.

Full disclosure: The attached patch was authored by an LLM and can therefore
not be incorporated as-is into GCC. Nevertheless, I hope that this will lead a
maintainer on the right track to quickly assess and fix the issue.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.