This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Fix tst_wcscpy.c test
- From: "Carlos O'Donell" <carlos at redhat dot com>
- To: Marek Polacek <polacek at redhat dot com>, libc-alpha at sourceware dot org
- Date: Tue, 20 Jan 2015 19:32:08 -0500
- Subject: Re: [PATCH] Fix tst_wcscpy.c test
- Authentication-results: sourceware.org; auth=none
- References: <20150120185919 dot GI3074 at redhat dot com>
On 01/20/2015 01:59 PM, Marek Polacek wrote:
> 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)
> {
We are in a freeze, but bug fixes are allowed.
Please check this in.
Cheers,
Carlos.