This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/14639] [3.5 Regression] [non-unit-at-a-time] Incorrect emission of unused compiler-generated destructor
- From: "hubicka at ucw dot cz" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Jun 2004 21:11:49 -0000
- Subject: [Bug c++/14639] [3.5 Regression] [non-unit-at-a-time] Incorrect emission of unused compiler-generated destructor
- References: <20040318204634.14639.austern@apple.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From hubicka at ucw dot cz 2004-06-04 21:11 -------
Subject: Re: [3.5 Regression] [non-unit-at-a-time] Incorrect emission of unused compiler-generated destructor
>
> ------- Additional Comments From pinskia at gcc dot gnu dot org 2004-06-04 01:50 -------
> This should fix it by making non-unit-at-a-time more like unit-at-a-time also removes one ??? to fix
> the rest of the way because now we mark the variables when outputing the asm so there is no need to
> do it while analyzing the function. I have not tested or bootstrapped this yet, Robert could you test this
> as I have a test to study for/do?
>
> Index: passes.c
> ===============================================================
> ====
> RCS file: /cvs/gcc/gcc/gcc/passes.c,v
> retrieving revision 2.17
> diff -u -p -r2.17 passes.c
> --- passes.c 30 May 2004 18:32:27 -0000 2.17
> +++ passes.c 4 Jun 2004 01:45:17 -0000
> @@ -370,7 +370,7 @@ rest_of_decl_compilation (tree decl,
> || (flag_unit_at_a_time && DECL_INITIAL (decl)))
> && !DECL_EXTERNAL (decl))
> {
> - if (flag_unit_at_a_time && !cgraph_global_info_ready
> + if (!cgraph_global_info_ready
> && TREE_CODE (decl) != FUNCTION_DECL && top_level)
> cgraph_varpool_finalize_decl (decl);
> else
> Index: cgraphunit.c
> ===============================================================
> ====
> RCS file: /cvs/gcc/gcc/gcc/cgraphunit.c,v
> retrieving revision 1.64
> diff -u -p -r1.64 cgraphunit.c
> --- cgraphunit.c 30 May 2004 18:32:24 -0000 1.64
> +++ cgraphunit.c 4 Jun 2004 01:45:17 -0000
> @@ -395,11 +395,6 @@ record_call_1 (tree *tp, int *walk_subtr
> switch (TREE_CODE (t))
> {
> case VAR_DECL:
> - /* ??? Really, we should mark this decl as *potentially* referenced
> - by this function and re-examine whether the decl is actually used
> - after rtl has been generated. */
> - if (TREE_STATIC (t))
> - cgraph_varpool_mark_needed_node (cgraph_varpool_node (t));
The mark call here must stay (it is the only place we do the
reachability analysis in the case we will drop it here compiler will
break at least if we get past the callback from the asm outputting code
(I am currently testing patch to do it but it has problems still...)
The "needed" in cgraph sense is "conservatively needed" so the Richard
comment should be probably placed elsewhere as this is defect of
callgraph code affecting both functions and variables. The problem is
that at the moment cgraph code is trusting to "needed" flag for
variables and output them early instead of later pass really checking
whether they are really needed (ie still referenced by the optimized
body of function). The reason why it is done this way is that I still
rely on backend calling me back when variable is needed as it is quite
non-trivial to do the reachability analysis on all kinds of
datastructures output by the front-end. I am working on that as we
speak, but it will take time (I just hit problems with Java and
objective C bypassing the cgraph as I feared)
Honza
> break;
>
> case ADDR_EXPR:
>
>
> --
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14639
>
> ------- You are receiving this mail because: -------
> You are on the CC list for the bug, or are watching someone who is.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14639