public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/53341] New: overloaded operator delete(void *) appear in object file even when not directly used
@ 2012-05-14 10:39 mh+gcc at glandium dot org
  2024-04-06 22:11 ` [Bug c++/53341] " pinskia at gcc dot gnu.org
  2024-04-08 10:08 ` redi at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: mh+gcc at glandium dot org @ 2012-05-14 10:39 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53341

             Bug #: 53341
           Summary: overloaded operator delete(void *) appear in object
                    file even when not directly used
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: mh+gcc@glandium.org


Consider the following program:

---------8<----------
#include <algorithm>
extern void moz_free(void *ptr);

__attribute__((always_inline)) inline
void operator delete(void* ptr) throw()
{
    return moz_free(ptr);
}

int foo() {
    return 42;
}
---------8<----------

g++ -std=c++0x will put two symbols in the resulting object:
_ZdlPv and _Z3foov. The former is operator delete(void *)

This doesn't happen when including <new> instead of <algorithm>.

This doesn't happen without -std=c++0x.

This doesn't happen with operator new, operator new[], or operator delete[].

This doesn't happen when removing __attribute__((__externally_visible__)) from
/usr/include/c++/4.7/new. (added in bug 50594)


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

* [Bug c++/53341] overloaded operator delete(void *) appear in object file even when not directly used
  2012-05-14 10:39 [Bug c++/53341] New: overloaded operator delete(void *) appear in object file even when not directly used mh+gcc at glandium dot org
@ 2024-04-06 22:11 ` pinskia at gcc dot gnu.org
  2024-04-08 10:08 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-06 22:11 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
   Target Milestone|---                         |4.8.0
         Resolution|---                         |FIXED

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed in GCC 4.8. Tested even using the preprocessed source that was got from
4.7.0 which had the operator delete in the generated assembly.

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

* [Bug c++/53341] overloaded operator delete(void *) appear in object file even when not directly used
  2012-05-14 10:39 [Bug c++/53341] New: overloaded operator delete(void *) appear in object file even when not directly used mh+gcc at glandium dot org
  2024-04-06 22:11 ` [Bug c++/53341] " pinskia at gcc dot gnu.org
@ 2024-04-08 10:08 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2024-04-08 10:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Bisections indicates it was fixed by this commit:

commit ead84f73b0a0f39ea39aa0329b6da83e4a9e6e02 [r0-116315-gead84f73b0a0f3]
Author: Jan Hubicka
Date:   Fri Apr 20 15:09:11 2012

    lto-symtab.c (lto_cgraph_replace_node): Merge needed instead of force
flags.

            * lto-symtab.c (lto_cgraph_replace_node): Merge needed instead of
force flags.
            * cgraph.c (cgraph_add_thunk): Use mark_reachable_node.
            (cgraph_remove_node): Update.
            (cgraph_mark_needed_node): Remove.
            (cgraph_mark_force_output_node): New.
            (dump_cgraph_node): Do not dump needed flag.
            (cgraph_node_cannot_be_local_p_1): Update.
            (cgraph_can_remove_if_no_direct_calls_and_refs): Update.
            * cgraph.h (symtab_node_base): Add force_output flag.
            (cgraph_node): Remove needed flag.
            (varpool_node): Remove force_output flag.
            (cgraph_mark_needed_node): Remove.
            (cgraph_mark_force_output_node): New.
            (cgraph_only_called_directly_or_aliased_p,
            varpool_can_remove_if_no_refs, varpool_all_refs_explicit_p):
Update.
            * ipa-cp.c (ipcp_generate_summary): Remove out of date assert.
            * cgraphunit.c (cgraph_decide_is_function_needed): rewrite.
            (cgraph_add_new_function); Update.
            (cgraph_mark_if_needed); Update.
            (verify_cgraph_node): Update.
            (cgraph_analyze_function): Alias target is reachable.
            (process_function_and_variable_attributes): Update:
externally_visible
            flag makes function reachable.
            (cgraph_analyze_functions): Update dumping.
            * lto-cgraph.c (lto_output_node, lto_output_varpool_node,
            input_overwrite_node, input_varpool_node): Update streaming.
            * lto-streamer-out.c (produce_symtab): Use force_output.
            * ipa.c (process_references): Weakrefs must be processed.
            (cgraph_remove_unreachable_nodes): Likewise; update for new
            force_output flag.
            (varpool_externally_visible_p); Weakrefs are externally visible
            even if they are not.
            (function_and_variable_visibility): Update; when processing alias
            pair force the targets to be output.
            (whole_program_function_and_variable_visility): Use
mark_reachable_node.
            * trans-mem.c (ipa_tm_mark_needed_node): Remove
            (ipa_tm_mark_force_output_node): New function.
            (ipa_tm_create_version_alias, ipa_tm_create_version): Update.
            * gimple-fold.c (can_refer_decl_in_current_unit_p): Be lax about
aliases.
            * varasm.c (mark_decl_referenced): Update.
            (find_decl_and_mark_needed): Remove.
            (find_decl): New function.
            (weak_finish, finish_aliases_1, assemble_alias): Update; do not
mark
            alias targets as needed.
            (dump_tm_clone_pairs): Update.
            * tree-inline.c (copy_bb): Update check.
            * symtab.c (dump_symtab_base): Dump force_output.
            * tree-ssa-structalias.c (ipa_pta_execute): Use force_output.
            * passes.c (execute_todo): Fix dumping.
            * varpool.c (decide_is_variable_needed, varpool_finalize_decl):
Update.
            (varpool_analyze_pending_decls): Alias target is reachable.
            (varpool_create_variable_alias): Finalize weakrefs.

            * class.c (make_local_function_alias): Do not mark symbol
referenced.

            * objc-acct.c (mark_referenced_methods); Use
            cgraph_mark_force_output_node.

            * gcc-interface/utils.c (gnat_write_global_declarations): Update
for new
            force_output placement.

            * lto/lto-partition.c (partition_cgraph_node_p): Use force_output.

    From-SVN: r186624

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

end of thread, other threads:[~2024-04-08 10:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-14 10:39 [Bug c++/53341] New: overloaded operator delete(void *) appear in object file even when not directly used mh+gcc at glandium dot org
2024-04-06 22:11 ` [Bug c++/53341] " pinskia at gcc dot gnu.org
2024-04-08 10:08 ` redi 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).