diff options
author | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-05-23 18:11:04 +0000 |
---|---|---|
committer | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-05-23 18:11:04 +0000 |
commit | 15bccea94e87747d5a786927a1087f7073a29265 (patch) | |
tree | 8d96cee5f637f07d622e051d659a07f1f11da2df /gcc | |
parent | cdd43af802013e32e5083bf8eb926e724aeba90c (diff) | |
download | gcc-15bccea94e87747d5a786927a1087f7073a29265.tar.gz |
* varasm.c (make_decl_rtl): Don't allow weak variables to be
placed in common.
* gcc/testsuite/gcc.dg/weak-8.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@53798 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/weak-8.c | 10 | ||||
-rw-r--r-- | gcc/varasm.c | 4 |
4 files changed, 23 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fb3802dd0cf..f90aa474507 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 573f3394709..fb0340638ac 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +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 diff --git a/gcc/testsuite/gcc.dg/weak-8.c b/gcc/testsuite/gcc.dg/weak-8.c new file mode 100644 index 00000000000..9cfb51706aa --- /dev/null +++ b/gcc/testsuite/gcc.dg/weak-8.c @@ -0,0 +1,10 @@ +/* { 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; +} diff --git a/gcc/varasm.c b/gcc/varasm.c index a055bbf0010..8a7f949245c 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). |