* varasm.c (make_decl_rtl): Don't allow weak variables to be
placed in common.
* gcc/testsuite/gcc.dg/weak-8.c: New test.
From-SVN: r53798
+2002-05-23 Mark Mitchell <mark@codesourcery.com>
+
+ * varasm.c (make_decl_rtl): Don't allow weak variables to be
+ placed in common.
+
Thu May 23 19:43:41 CEST 2002 Jan Hubicka <jh@suse.cz>
* cfg.c (dump_flow_info): Print results of
+2002-05-23 Mark Mitchell <mark@codesourcery.com>
+
+ * gcc/testsuite/gcc.dg/weak-8.c: New test.
+
Thu May 23 11:09:26 2002 J"orn Rennecke <joern.rennecke@superh.com>
* gcc.dg/weak-2.c: Allow optional leading underscore
--- /dev/null
+/* { dg-do assemble } */
+
+/* COFF does not support weak, and dg doesn't support UNSUPPORTED. */
+/* { dg-do assemble { xfail *-*-coff i?86-pc-cygwin h8300-*-hms } } */
+
+__attribute__ ((weak)) int i;
+
+int f() {
+ return i;
+}
&& DECL_COMMON (decl))
DECL_COMMON (decl) = 0;
+ /* Variables can't be both common and weak. */
+ if (TREE_CODE (decl) == VAR_DECL && DECL_WEAK (decl))
+ DECL_COMMON (decl) = 0;
+
/* Can't use just the variable's own name for a variable
whose scope is less than the whole file, unless it's a member
of a local class (which will already be unambiguous).