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

anlauf at gcc dot gnu.org changed:

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

--- Comment #5 from anlauf at gcc dot gnu.org ---
Created attachment 62363
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=62363&action=edit
Slightly rewritten reproducer

This slight rewrite might help pinning down where the memory corruption is
happening.

This prints at runtime:

1) a=b:
 Check allocation status after 1)
 a: T T
 b: T T
 2) b=a:
 Check allocation status after 2)
 a: T T
 b: T T
 3) a=b:
free(): double free detected in tcache 2

Program received signal SIGABRT: Process abort signal.


crashing at the third assignment.

Activating the code that tries to deallocate the components on the lhs
leads to:

 1) a=b:
 Check allocation status after 1)
 a: T T
 b: T T
 explicitly deallocate components of b
 2) b=a:
 Check allocation status after 2)
 a: T F
 b: T F
STOP 2

So this also deallocates not only the components of b, but also the
nested component of a!

Duh.

Reply via email to