* [PATCH] Fix tst-chk{2,3}.c
@ 2004-11-02 21:28 Jakub Jelinek
0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2004-11-02 21:28 UTC (permalink / raw)
To: Ulrich Drepper, Roland McGrath; +Cc: Glibc hackers
Hi!
On some arches (namely ia64 and s390 (31-bit)) tst-chk{2,3} fails with exit
code 1, although it prints no failure messages.
The problem is that ret is a local variable whose address is not taken
and GCC when seeing say __memcpy_chk (....); ret = 1; reorders ret setting
before the __memcpy_chk call (but __memcpy_chk is not supposed to return,
but __chk_fail()ed).
Fix below (plus I have removed redundant ret = 1; setting in CHK_FAIL_END
- FAIL () macro already sets ret = 1).
2004-11-02 Jakub Jelinek <jakub@redhat.com>
* debug/tst-chk1.c (ret): New volatile variable.
(CHK_FAIL_END): Remove redundant ret setting.
(do_test): Remote ret variable.
--- libc/debug/tst-chk1.c.jj 2004-11-02 22:21:48.000000000 +0100
+++ libc/debug/tst-chk1.c 2004-11-02 22:22:17.037902927 +0100
@@ -50,7 +50,7 @@ do_prepare (void)
}
}
-volatile int chk_fail_ok;
+volatile int chk_fail_ok, ret;
jmp_buf chk_fail_buf;
static void
@@ -86,7 +86,6 @@ int num2 = 987654;
#define CHK_FAIL_END \
chk_fail_ok = 0; \
FAIL (); \
- ret = 1; \
}
#if __USE_FORTIFY_LEVEL >= 2
#define CHK_FAIL2_START CHK_FAIL_START
@@ -99,7 +98,6 @@ int num2 = 987654;
static int
do_test (void)
{
- int ret = 0;
struct sigaction sa;
sa.sa_handler = handler;
sa.sa_flags = 0;
Jakub
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-11-02 21:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-02 21:28 [PATCH] Fix tst-chk{2,3}.c Jakub Jelinek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).