+2015-08-25 Marek Polacek <polacek@redhat.com>
+
+ PR middle-end/67330
+ * varasm.c (declare_weak): Return after giving an error.
+
2015-08-25 David Malcolm <dmalcolm@redhat.com>
* gcc-main.c (main): Add params to driver ctor.
+2015-08-25 Marek Polacek <polacek@redhat.com>
+
+ PR middle-end/67330
+ * c-common.c (handle_weak_attribute): Don't check whether the
+ visibility can be changed here.
+
2015-08-22 Manuel López-Ibáñez <manu@gcc.gnu.org>
* c-lex.c (c_lex_with_flags): Use explicit locations.
return NULL_TREE;
}
else if (VAR_OR_FUNCTION_DECL_P (*node))
- {
- struct symtab_node *n = symtab_node::get (*node);
- if (n && n->refuse_visibility_changes)
- error ("%+D declared weak after being used", *node);
- declare_weak (*node);
- }
+ declare_weak (*node);
else
warning (OPT_Wattributes, "%qE attribute ignored", name);
+2015-08-25 Marek Polacek <polacek@redhat.com>
+
+ PR middle-end/67330
+ * gcc.dg/weak/weak-18.c: New test.
+
2015-08-25 David Malcolm <dmalcolm@redhat.com>
* jit.dg/test-error-pr63969-missing-driver.c: Add call to
--- /dev/null
+/* PR middle-end/67330 */
+/* { dg-do compile } */
+/* { dg-require-weak "" } */
+
+void
+f (void)
+{
+ __attribute__ ((weak)) int a; /* { dg-error "weak declaration of .a. must be public" } */
+}
{
gcc_assert (TREE_CODE (decl) != FUNCTION_DECL || !TREE_ASM_WRITTEN (decl));
if (! TREE_PUBLIC (decl))
- error ("weak declaration of %q+D must be public", decl);
+ {
+ error ("weak declaration of %q+D must be public", decl);
+ return;
+ }
else if (!TARGET_SUPPORTS_WEAK)
warning (0, "weak declaration of %q+D not supported", decl);