diff options
author | Jan Hubicka <hubicka@ucw.cz> | 2014-09-20 01:56:52 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2014-09-19 23:56:52 +0000 |
commit | f7217cde7f382aeb19dd3e80bc8f7ffae798315f (patch) | |
tree | d7d5f6d00208bddb323b80ac27eed3ded29bed4a /gcc/symtab.c | |
parent | 3f99b0612f7db76b6ed1a25ecce8fa327eec9f61 (diff) | |
download | gcc-f7217cde7f382aeb19dd3e80bc8f7ffae798315f.zip gcc-f7217cde7f382aeb19dd3e80bc8f7ffae798315f.tar.gz gcc-f7217cde7f382aeb19dd3e80bc8f7ffae798315f.tar.bz2 |
re PR c++/61825 (g++.dg/cpp0x/static_assert9.C FAILs)
PR c++/61825
* c-family/c-common.c (handle_alias_ifunc_attribute): Check
that visibility change is possible
(handle_weakref_attribute): Likewise.
* cgraph.h (symtab_node): Add method get_create and
field refuse_visibility_changes.
(symtab_node::get_create): New method.
* fold-const.c (tree_single_nonzero_warnv_p): Use get_create.
* varasm.c (mark_weak): Verify that visibility change is
possible.
* gcc.dg/tree-ssa/nonzero-1.c: Require error to be output.
From-SVN: r215409
Diffstat (limited to 'gcc/symtab.c')
-rw-r--r-- | gcc/symtab.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/gcc/symtab.c b/gcc/symtab.c index 792b3b5..9590fc8 100644 --- a/gcc/symtab.c +++ b/gcc/symtab.c @@ -1811,9 +1811,9 @@ bool symtab_node::nonzero_address () { /* Weakrefs may be NULL when their target is not defined. */ - if (this->alias && this->weakref) + if (alias && weakref) { - if (this->analyzed) + if (analyzed) { symtab_node *target = ultimate_alias_target (); @@ -1828,7 +1828,7 @@ symtab_node::nonzero_address () could be useful to eliminate the NULL pointer checks in LTO programs. */ if (target->definition && !DECL_EXTERNAL (target->decl)) - return true; + return true; if (target->resolution != LDPR_UNKNOWN && target->resolution != LDPR_UNDEF && flag_delete_null_pointer_checks) @@ -1847,22 +1847,28 @@ symtab_node::nonzero_address () Those are handled by later check for definition. When parsing, beware the cases when WEAK attribute is added later. */ - if (!DECL_WEAK (this->decl) - && flag_delete_null_pointer_checks - && symtab->state > PARSING) - return true; + if (!DECL_WEAK (decl) + && flag_delete_null_pointer_checks) + { + refuse_visibility_changes = true; + return true; + } /* If target is defined and not extern, we know it will be output and thus it will bind to non-NULL. Play safe for flag_delete_null_pointer_checks where weak definition maye be re-defined by NULL. */ - if (this->definition && !DECL_EXTERNAL (this->decl) - && (flag_delete_null_pointer_checks || !DECL_WEAK (this->decl))) - return true; + if (definition && !DECL_EXTERNAL (decl) + && (flag_delete_null_pointer_checks || !DECL_WEAK (decl))) + { + if (!DECL_WEAK (decl)) + refuse_visibility_changes = true; + return true; + } /* As the last resort, check the resolution info. */ - if (this->resolution != LDPR_UNKNOWN - && this->resolution != LDPR_UNDEF + if (resolution != LDPR_UNKNOWN + && resolution != LDPR_UNDEF && flag_delete_null_pointer_checks) return true; return false; |