This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] Fix tst_wcscpy.c test
- From: Marek Polacek <polacek at redhat dot com>
- To: libc-alpha at sourceware dot org
- Date: Tue, 20 Jan 2015 19:59:19 +0100
- Subject: [PATCH] Fix tst_wcscpy.c test
- Authentication-results: sourceware.org; auth=none
Compiling glibc with gcc 5 revealed that the following test is failing
due to
tests-mbwc/tst_wcscpy.c: In function 'tst_wcscpy':
tests-mbwc/tst_wcscpy.c:44:42: error: loop exit may only be reached after undefined behavior [-Werror=aggressive-loop-optimizations]
(ws1[i] != 0L || ws_ex[i] != 0L) && i < WCSSIZE; i++)
^
tests-mbwc/tst_wcscpy.c:44:13: note: possible undefined statement is here
(ws1[i] != 0L || ws_ex[i] != 0L) && i < WCSSIZE; i++)
^
cc1: all warnings being treated as errors
and this indeed looks like a bug. Thus fixed. I tested only this testcase,
not the rest of the testsuite.
Ok for mainline? (Or are you in the middle of a freeze?)
2015-01-20 Marek Polacek <polacek@redhat.com>
* tests-mbwc/tst_wcscpy.c (tst_wcscpy): Fix condition.
diff --git a/localedata/tests-mbwc/tst_wcscpy.c b/localedata/tests-mbwc/tst_wcscpy.c
index d5705a5..a30a6e5 100644
--- a/localedata/tests-mbwc/tst_wcscpy.c
+++ b/localedata/tests-mbwc/tst_wcscpy.c
@@ -41,7 +41,7 @@ tst_wcscpy (FILE * fp, int debug_flg)
ws_ex = TST_EXPECT (wcscpy).ws;
for (err = 0, i = 0;
- (ws1[i] != 0L || ws_ex[i] != 0L) && i < WCSSIZE; i++)
+ i < WCSSIZE && (ws1[i] != 0L || ws_ex[i] != 0L); i++)
{
if (debug_flg)
{
Marek