Commit 9ec5d66b by Nick Clifton Committed by Nick Clifton

re PR go/49889 (Calling a function whose name is obscured by a local variable…

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
parent 2e885a6f
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>
* params.def (MAX_PARTITION_SIZE): New param.
......
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>
* c-c++-common/memset-array.c: New test.
......
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)
|| !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)
{
/* We put the NEWDECL on the weak_decls list at some point.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment