public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/93922] [10 Regression] Fails to emit inline class template destructor instantiation, but which is called
       [not found] <bug-93922-4@http.gcc.gnu.org/bugzilla/>
@ 2020-03-09 17:10 ` jakub at gcc dot gnu.org
  2020-03-09 17:51 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-09 17:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Testcase modified to be usable in the testsuite:
// PR c++/93922
// { dg-do link { target c++11 } }

template <typename T>
struct A {
  A () {}
  template <typename U>
  A (A<U> const &) {}
  ~A () {}
};
int t;
struct B {};
struct C : B { C (B const &) { if (t) throw 1; } };
struct S { A<B const> x; C y; };

A<B>
bar (B *)
{
  return A<B> ();
}

S *
foo (B *x, B const &y)
{
  return new S {bar (x), y};
}

int
main ()
{
}

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/93922] [10 Regression] Fails to emit inline class template destructor instantiation, but which is called
       [not found] <bug-93922-4@http.gcc.gnu.org/bugzilla/>
  2020-03-09 17:10 ` [Bug c++/93922] [10 Regression] Fails to emit inline class template destructor instantiation, but which is called jakub at gcc dot gnu.org
@ 2020-03-09 17:51 ` jakub at gcc dot gnu.org
  2020-03-10 19:57 ` jason at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-09 17:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The problem as I understand it is that
#1  0x0000000000abeb95 in mark_used (decl=<function_decl 0x7fffea955b00
__dt_comp >, complain=3) at ../../gcc/cp/decl2.c:5686
#2  0x0000000000987243 in build_over_call (cand=0x375c910, flags=35,
complain=3) at ../../gcc/cp/call.c:9020
#3  0x000000000098c640 in build_new_method_call_1 (instance=<indirect_ref
0x7fffea969c20>, fns=<function_decl 0x7fffea955b00 __dt_comp >, 
    args=0x0, conversion_path=<tree_binfo 0x7fffea93e900>, flags=35, fn_p=0x0,
complain=3) at ../../gcc/cp/call.c:10305
#4  0x000000000098cb2e in build_new_method_call (instance=<indirect_ref
0x7fffea969c20>, fns=<baselink 0x7fffea972060>, args=0x0, 
    conversion_path=<tree_binfo 0x7fffea93e900>, flags=35, fn_p=0x0,
complain=3) at ../../gcc/cp/call.c:10380
#5  0x000000000098a256 in build_special_member_call (instance=<indirect_ref
0x7fffea969c20>, name=<identifier_node 0x7fffea80e9c0 __dt_comp >, 
    args=0x0, binfo=<tree_binfo 0x7fffea93e900>, flags=35, complain=3) at
../../gcc/cp/call.c:9781
#6  0x0000000000afa23c in build_dtor_call (exp=<indirect_ref 0x7fffea969c20>,
dtor_kind=sfk_complete_destructor, flags=35, complain=3)
    at ../../gcc/cp/init.c:4786
#7  0x0000000000afaaca in build_delete (loc=0, otype=<pointer_type
0x7fffea958150>, addr=<nop_expr 0x7fffea969c00>, 
    auto_delete=sfk_complete_destructor, flags=35, use_global_delete=0,
complain=3) at ../../gcc/cp/init.c:4979
#8  0x0000000000a9e585 in cxx_maybe_build_cleanup (decl=<component_ref
0x7fffea972030>, complain=3) at ../../gcc/cp/decl.c:17394
#9  0x0000000000d130b8 in split_nonconstant_init_1 (dest=<mem_ref
0x7fffea963de8>, init=<constructor 0x7fffea947978>, nested=false)
    at ../../gcc/cp/typeck2.c:714
#10 0x0000000000d1351a in split_nonconstant_init (dest=<mem_ref
0x7fffea963de8>, init=<constructor 0x7fffea947978>) at
../../gcc/cp/typeck2.c:784
happens too late, after pending templates have been instantiated.
So, either mark_used or maybe_instantiate_decl needs to not defer if at_eof (or
at_eof == 2?), or perhaps better discover that split_nonconstant_init_1 will
need to call the descriptor earlier (dunno where exactly, cp_fold or
cp_genericize_r?).
I think the latter would be better, e.g. with OpenMP implicit declare target
discovery I was hoping one could hook somewhere into cgraph in between where
the FE already saw all functions and before first functions are gimplified, but
if gimplification can result in new functions to be instantiated, genericized
and later on gimplified and again and again, this wouldn't be possible.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/93922] [10 Regression] Fails to emit inline class template destructor instantiation, but which is called
       [not found] <bug-93922-4@http.gcc.gnu.org/bugzilla/>
  2020-03-09 17:10 ` [Bug c++/93922] [10 Regression] Fails to emit inline class template destructor instantiation, but which is called jakub at gcc dot gnu.org
  2020-03-09 17:51 ` jakub at gcc dot gnu.org
@ 2020-03-10 19:57 ` jason at gcc dot gnu.org
  2020-03-10 20:37 ` jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2020-03-10 19:57 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/93922] [10 Regression] Fails to emit inline class template destructor instantiation, but which is called
       [not found] <bug-93922-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2020-03-10 19:57 ` jason at gcc dot gnu.org
@ 2020-03-10 20:37 ` jason at gcc dot gnu.org
  2020-03-11  6:59 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2020-03-10 20:37 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed by reverting the patch for PR 66139.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/93922] [10 Regression] Fails to emit inline class template destructor instantiation, but which is called
       [not found] <bug-93922-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2020-03-10 20:37 ` jason at gcc dot gnu.org
@ 2020-03-11  6:59 ` jakub at gcc dot gnu.org
  2020-03-11  9:32 ` sbergman at redhat dot com
  2022-01-07  0:28 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-11  6:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
commit r10-7110-g14af5d9b19b0f4ee1d929e505e245ae5c2f6bdc6
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Mar 10 16:05:18 2020 -0400

    c++: Partially revert patch for PR66139.

    The patch for 66139 exposed a long-standing bug with
    split_nonconstant_init (since 4.7, apparently): initializion of individual
    elements of an aggregate are not a full-expressions, but
    split_nonconstant_init was making full-expressions out of them.  My fix for
    66139 extended the use of split_nonconstant_init, and thus the bug, to
    aggregate initialization of temporaries within an expression, in which
    context (PR94041) the bug is more noticeable.  PR93922 is a problem with my
    implementation strategy of splitting out at gimplification time,
introducing
    function calls that weren't in the GENERIC.  So I'm going to revert the
    patch now and try again for GCC 11.

    gcc/cp/ChangeLog
    2020-03-10  Jason Merrill  <jason@redhat.com>

            PR c++/93922
            PR c++/94041
            PR c++/52320
            PR c++/66139
            * cp-gimplify.c (cp_gimplify_init_expr): Partially revert patch for
            66139: Don't split_nonconstant_init.  Remove pre_p parameter.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/93922] [10 Regression] Fails to emit inline class template destructor instantiation, but which is called
       [not found] <bug-93922-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2020-03-11  6:59 ` jakub at gcc dot gnu.org
@ 2020-03-11  9:32 ` sbergman at redhat dot com
  2022-01-07  0:28 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 7+ messages in thread
From: sbergman at redhat dot com @ 2020-03-11  9:32 UTC (permalink / raw)
  To: gcc-bugs

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

Stephan Bergmann <sbergman at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |VERIFIED

--- Comment #9 from Stephan Bergmann <sbergman at redhat dot com> ---
(In reply to Jakub Jelinek from comment #8)
> commit r10-7110-g14af5d9b19b0f4ee1d929e505e245ae5c2f6bdc6
> Author: Jason Merrill <jason@redhat.com>
> Date:   Tue Mar 10 16:05:18 2020 -0400
> 
>     c++: Partially revert patch for PR66139.

I can confirm that this fixes my original issue (building Skia as part of
LibreOffice), from which the reproducer in comment 0 had been distilled.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/93922] [10 Regression] Fails to emit inline class template destructor instantiation, but which is called
       [not found] <bug-93922-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2020-03-11  9:32 ` sbergman at redhat dot com
@ 2022-01-07  0:28 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2022-01-07  0:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93922
Bug 93922 depends on bug 66139, which changed state.

Bug 66139 Summary: destructor not called for members of partially constructed anonymous struct/array
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66139

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-01-07  0:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-93922-4@http.gcc.gnu.org/bugzilla/>
2020-03-09 17:10 ` [Bug c++/93922] [10 Regression] Fails to emit inline class template destructor instantiation, but which is called jakub at gcc dot gnu.org
2020-03-09 17:51 ` jakub at gcc dot gnu.org
2020-03-10 19:57 ` jason at gcc dot gnu.org
2020-03-10 20:37 ` jason at gcc dot gnu.org
2020-03-11  6:59 ` jakub at gcc dot gnu.org
2020-03-11  9:32 ` sbergman at redhat dot com
2022-01-07  0:28 ` jason at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).