This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/53476] [4.8 Regression] FAIL: gcc.dg/attr-weakref-1.c


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

--- Comment #10 from Jan Hubicka <hubicka at ucw dot cz> 2012-12-13 20:56:13 UTC ---
> (gdb) call debug_tree (node->symbol.decl)
>  <var_decl 0x7ffff68045f0 Wv10a
>     type <integer_type 0x7ffff67f75e8 int public SI
>         size <integer_cst 0x7ffff67fa0c0 constant 32>
>         unit size <integer_cst 0x7ffff67fa0e0 constant 4>
>         align 32 symtab 0 alias set -1 canonical type 0x7ffff67f75e8 precision
> 32 min <integer_cst 0x7ffff67fa060 -2147483648> max <integer_cst 0x7ffff67fa080
> 2147483647>
>         pointer_to_this <pointer_type 0x7ffff67ff2a0>>
>     addressable used static external weak SI file t.c line 1 col 12 size
> <integer_cst 0x7ffff67fa0c0 32> unit size <integer_cst 0x7ffff67fa0e0 4>
>     align 32 context <translation_unit_decl 0x7ffff6918000 D.1721> attributes
> <tree_list 0x7ffff68f3c08>
>     (mem:SI (symbol_ref/i:DI ("Wv10a") <var_decl 0x7ffff68045f0 Wv10a>) [0
> Wv10a+0 S4 A32]) chain <var_decl 0x7ffff6804688 Wv10b>>
> 
> it has DECL_EXTERNAL set (but it also is TREE_STATIC and has RTL!).
> On the 4.7 branch we simply checked whether the DECL had RTL but didn't bother
> to check whether it does not have DECL_EXTERNAL set.
> 
> I'd say either revert to 4.7 behavior here or do
> 
> Index: varpool.c
> ===================================================================
> --- varpool.c   (revision 194472)
> +++ varpool.c   (working copy)
> @@ -358,7 +358,8 @@ varpool_remove_unreferenced_decls (void)
>           && (!varpool_can_remove_if_no_refs (node)
>               /* We just expanded all function bodies.  See if any of
>                  them needed the variable.  */
> -             || (!DECL_EXTERNAL (node->symbol.decl)
> +             || (!(DECL_EXTERNAL (node->symbol.decl)
> +                   && !TREE_STATIC (node->symbol.decl))

Oops, thanks! I had similar hunk sitting in my tree for a while, but forgot to
commit it.

The point of nor marking extenral as used at this point was to release memory
used by identifiers because at this stage they do not matter, but since we gave
up on that, I guess this is fine.

For 4.9 I think I should look into reorganizing weakrefs to have different
tree representation. This abuse of external flag is really anoying.

Honza


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]