This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH, testsuite] Remove static from __stack_chk_fail in gcc.dg/ssp-1.c
- From: Adam Nemet <anemet at caviumnetworks dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 27 Apr 2009 17:54:01 -0700
- Subject: [PATCH, testsuite] Remove static from __stack_chk_fail in gcc.dg/ssp-1.c
As I reported in my MIPS -fstack-protector patch this test is failing on MIPS.
__stack_chk_fail is an internal function to the GCC runtime (libssp), however,
the tests ssp-1.c and ssp-2.c redefine it as a way to signal the outcome of
the tests.
In ssp-1.c the function is defined static while in
default_hidden_stack_protect_fail it is declared global. This is not valid C;
a static declaration cannot follow a non-static but this being an internal
function we don't diagnose in pushdecl.
The patch below removes the static (in ssp-2.c the function in non-static).
The test now passes (together with MIPS -fstack-protector patch) and does not
regress on x86_64-linux either.
OK?
Adam
* gcc.dg/ssp-1.c (__stack_chk_fail): Remove static.
Index: ssp-1.c
===================================================================
--- ssp-1.c (revision 146303)
+++ ssp-1.c (working copy)
@@ -4,7 +4,7 @@
#include <stdlib.h>
-static void
+void
__stack_chk_fail (void)
{
exit (0); /* pass */