]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/symtab.c
re PR c++/61825 (g++.dg/cpp0x/static_assert9.C FAILs)
[thirdparty/gcc.git] / gcc / symtab.c
index 792b3b50ea6a04bf1ea228a6201475df825c3c45..9590fc83dd2c320501e634361a9ddd4b658c386c 100644 (file)
@@ -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;