[Bug c++/99479] [modules] ICE Aborted signal terminated program cc1plus

ppalka at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jan 24 15:52:25 GMT 2022


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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ppalka at gcc dot gnu.org

--- Comment #20 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #19)
> Created attachment 52106 [details]
> reduced testcase
> 
> Not even though it says PR 100129, this is the reduced testcase.
> just execute t.sh which does:
> gcc header.hh -std=c++20 -fmodules-ts
> gcc t.cc -std=c++20 -fmodules-ts -wrapper valgrind,--error-exitcode=1
> 
> And you will see the valgrind failures.

Looks like name_lookup::search_unqualified uses a static vector under the
assumption that the function isn't recursive:

  /* Make static to avoid continual reallocation.  We're not
     recursive.  */
  static using_queue *queue = NULL;

but with modules, this assumption appears to be untrue:

#0  name_lookup::search_unqualified (this=0x7fffffffcde0, scope=<namespace_decl
0x7ffff7263098 std>, level=0x7ffff73ba048) at
/home/patrick/code/gcc/gcc/cp/name-lookup.cc:1133
#1  0x0000000000aa33f5 in lookup_name (name=name@entry=<identifier_node
0x7ffff7261980 operator delete>, where=<optimized out>,
where@entry=LOOK_where::BLOCK_NAMESPACE, want=want@entry=LOOK_want::NORMAL)
    at /home/patrick/code/gcc/gcc/cp/name-lookup.cc:7736
#2  0x00000000009492be in build_op_delete_call (code=code@entry=DELETE_EXPR,
addr=<parm_decl 0x7ffff7fc5180 this>, size=<integer_cst 0x7ffff73b9150>,
global_p=global_p@entry=false, 
    placement=placement@entry=<tree 0x0>, alloc_fn=alloc_fn@entry=<tree 0x0>,
complain=3) at /home/patrick/code/gcc/gcc/cp/call.cc:7264
#3  0x0000000000aa9e63 in build_delete_destructor_body
(delete_dtor=<function_decl 0x7ffff7399800 __dt_del >,
complete_dtor=<function_decl 0x7ffff7399900 __dt_comp >)
    at /home/patrick/code/gcc/gcc/cp/optimize.cc:139
#4  0x0000000000aab5f9 in maybe_clone_body (fn=fn@entry=<function_decl
0x7ffff7399700 __dt >) at /home/patrick/code/gcc/gcc/cp/optimize.cc:592
#5  0x0000000000a678f8 in post_load_processing () at
/home/patrick/code/gcc/gcc/cp/module.cc:17185
#6  0x0000000000a8e61a in lazy_load_binding (mod=<optimized out>,
ns=ns@entry=<namespace_decl 0x7ffff7263098 std>, id=<identifier_node
0x7ffff7260b40 atomic>, mslot=mslot@entry=0x7ffff73a9d30)
    at /home/patrick/code/gcc/gcc/cp/module.cc:18792
#7  0x0000000000aa000f in name_lookup::search_namespace_only
(this=0x7fffffffd210, scope=<namespace_decl 0x7ffff7263098 std>) at
/home/patrick/code/gcc/gcc/cp/name-lookup.cc:927
#8  0x0000000000aa165c in name_lookup::search_unqualified (this=0x7fffffffd210,
scope=<namespace_decl 0x7ffff7263098 std>, level=<optimized out>) at
/home/patrick/code/gcc/gcc/cp/name-lookup.cc:1155
...

Using a non-static vector fixes the valgrind error.  Is this a fix that's worth
applying at this point?


More information about the Gcc-bugs mailing list