re PR go/49889 (Calling a function whose name is obscured by a local variable does not produce an error)
PR middle-end/49889 gcc * varasm.c (merge_weak): Generate an error if an attempt is made to convert a non-weak static function into a weak, public function. testsuite * gcc.dg/pr49889.c: New test. From-SVN: r235484
This commit is contained in:
parent
2e885a6f7c
commit
9ec5d66b5d
4 changed files with 19 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2016-04-27 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
|
PR middle-end/49889
|
||||||
|
* varasm.c (merge_weak): Generate an error if an attempt is made
|
||||||
|
to convert a non-weak static function into a weak, public function.
|
||||||
|
|
||||||
2016-04-27 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
|
2016-04-27 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
|
||||||
|
|
||||||
* params.def (MAX_PARTITION_SIZE): New param.
|
* params.def (MAX_PARTITION_SIZE): New param.
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
2016-04-27 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
|
PR middle-end/49889
|
||||||
|
* gcc.dg/pr49889.c: New test.
|
||||||
|
|
||||||
2016-04-27 Bernd Schmidt <bschmidt@redhat.com>
|
2016-04-27 Bernd Schmidt <bschmidt@redhat.com>
|
||||||
|
|
||||||
* c-c++-common/memset-array.c: New test.
|
* c-c++-common/memset-array.c: New test.
|
||||||
|
|
3
gcc/testsuite/gcc.dg/pr49899.c
Normal file
3
gcc/testsuite/gcc.dg/pr49899.c
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
static int foo (void) { return 0; } /* { dg-error "weak declaration of 'foo' being applied to a already existing, static definition" } */
|
||||||
|
int foo (void) __attribute__((weak));
|
||||||
|
|
|
@ -5371,6 +5371,11 @@ merge_weak (tree newdecl, tree olddecl)
|
||||||
gcc_assert (!TREE_USED (olddecl)
|
gcc_assert (!TREE_USED (olddecl)
|
||||||
|| !TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (olddecl)));
|
|| !TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (olddecl)));
|
||||||
|
|
||||||
|
/* PR 49899: You cannot convert a static function into a weak, public function. */
|
||||||
|
if (! TREE_PUBLIC (olddecl) && TREE_PUBLIC (newdecl))
|
||||||
|
error ("weak declaration of %q+D being applied to a already "
|
||||||
|
"existing, static definition", newdecl);
|
||||||
|
|
||||||
if (TARGET_SUPPORTS_WEAK)
|
if (TARGET_SUPPORTS_WEAK)
|
||||||
{
|
{
|
||||||
/* We put the NEWDECL on the weak_decls list at some point.
|
/* We put the NEWDECL on the weak_decls list at some point.
|
||||||
|
|
Loading…
Add table
Reference in a new issue