aboutsummaryrefslogtreecommitdiff
path: root/gcc/varasm.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2002-05-23 18:11:04 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2002-05-23 18:11:04 +0000
commit5ff225fc29052e61351a8e74a549ad5d1e4f5518 (patch)
tree8d96cee5f637f07d622e051d659a07f1f11da2df /gcc/varasm.c
parent0f72964f10dd338c59e1ea8e8eee3a966154540d (diff)
downloadgcc-5ff225fc29052e61351a8e74a549ad5d1e4f5518.zip
gcc-5ff225fc29052e61351a8e74a549ad5d1e4f5518.tar.gz
gcc-5ff225fc29052e61351a8e74a549ad5d1e4f5518.tar.bz2
varasm.c (make_decl_rtl): Don't allow weak variables to be placed in common.
* 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
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r--gcc/varasm.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c
index a055bbf..8a7f949 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -922,6 +922,10 @@ make_decl_rtl (decl, asmspec)
&& 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).