public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/86385] calling wrong constructors?
       [not found] <bug-86385-4@http.gcc.gnu.org/bugzilla/>
@ 2021-05-13 13:03 ` redi at gcc dot gnu.org
  2021-08-10  0:39 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2021-05-13 13:03 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2018-07-03 00:00:00         |2021-5-13

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
It's not calling the wrong constructor, GCC is just making a trivial copy of
the object (without using any constructor) for the second operand of the ?:
expression. That is never constructed using a constructor, but it is destroyed,
which causes the double free.

;; Function main (main, funcdef_no=14, decl_uid=2419, cgraph_uid=15,
symbol_order=14) (executed once)

int main ()
{
  struct A D.2421;
  struct A D.2423;
  void * _8;

  <bb 2> [local count: 1073741824]:
  D.2421 ={v} {CLOBBER};
  _8 = operator new (4);
  MEM[(int *)_8] = 42;
  D.2421.a = _8;
  __builtin_printf ("C %p\n", &D.2421);
  D.2423 = D.2421;
  A::~A (&D.2423);
  D.2423 ={v} {CLOBBER};
  A::~A (&D.2421);
  D.2421 ={v} {CLOBBER};
  return 0;

}

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

* [Bug c++/86385] calling wrong constructors?
       [not found] <bug-86385-4@http.gcc.gnu.org/bugzilla/>
  2021-05-13 13:03 ` [Bug c++/86385] calling wrong constructors? redi at gcc dot gnu.org
@ 2021-08-10  0:39 ` pinskia at gcc dot gnu.org
  2024-03-14 18:21 ` pinskia at gcc dot gnu.org
  2024-03-14 18:22 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-10  0:39 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |st at quanttec dot com

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 92467 has been marked as a duplicate of this bug. ***

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

* [Bug c++/86385] calling wrong constructors?
       [not found] <bug-86385-4@http.gcc.gnu.org/bugzilla/>
  2021-05-13 13:03 ` [Bug c++/86385] calling wrong constructors? redi at gcc dot gnu.org
  2021-08-10  0:39 ` pinskia at gcc dot gnu.org
@ 2024-03-14 18:21 ` pinskia at gcc dot gnu.org
  2024-03-14 18:22 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-14 18:21 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
   Target Milestone|---                         |13.0
             Status|NEW                         |RESOLVED

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed for GCC 13+ by r13-2964-gbbdb5612f6661f2c64b0c0f1d2291cb59fde2b40 .

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

* [Bug c++/86385] calling wrong constructors?
       [not found] <bug-86385-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2024-03-14 18:21 ` pinskia at gcc dot gnu.org
@ 2024-03-14 18:22 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-14 18:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #5)
> Fixed for GCC 13+ by r13-2964-gbbdb5612f6661f2c64b0c0f1d2291cb59fde2b40 .

Or by r13-2963-g32b2eb59fb9049 .

Anyways both together are needed IIRC.

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

end of thread, other threads:[~2024-03-14 18:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-86385-4@http.gcc.gnu.org/bugzilla/>
2021-05-13 13:03 ` [Bug c++/86385] calling wrong constructors? redi at gcc dot gnu.org
2021-08-10  0:39 ` pinskia at gcc dot gnu.org
2024-03-14 18:21 ` pinskia at gcc dot gnu.org
2024-03-14 18:22 ` pinskia 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).