* [committed] Handle targets with 2 byte wchar_t better in strlenopt-58.c
@ 2018-12-04 23:23 Jeff Law
0 siblings, 0 replies; 4+ messages in thread
From: Jeff Law @ 2018-12-04 23:23 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 548 bytes --]
This is another minor testsuite patch. strlenopt-58.c assumes 4 byte
wchar_t. On targets with a smaller wchar_t it will get an error/warning.
This patch adds a dg-warning on the appropriate lines for targets that
do not have 4byte wchar_t.
It's been tested on h8 to verify the bogus warnings/errors are gone. We
don't optimize it fully yet, but I'm not really focused on that kind of
error right now.
It's also been tested on x86_64 to verify that it didn't break anything
on targets with a 4 byte wchar_t.
Installing on the trunk.
Jeff
[-- Attachment #2: P --]
[-- Type: text/plain, Size: 1517 bytes --]
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 18ef9edb7ad..7aad09dae78 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2018-12-04 Jeff Law <law@redhat.com>
+
+ * gcc.dg/strlenopt-58.c: Handle targets with 2 byte wchar_t.
+
2018-12-04 Martin Sebor <msebor@redhat.com>
* gcc.target/i386/attr-aligned-2.c: New test.
diff --git a/gcc/testsuite/gcc.dg/strlenopt-58.c b/gcc/testsuite/gcc.dg/strlenopt-58.c
index e0e80680936..034961cd810 100644
--- a/gcc/testsuite/gcc.dg/strlenopt-58.c
+++ b/gcc/testsuite/gcc.dg/strlenopt-58.c
@@ -34,8 +34,8 @@ extern void* memchr (const void*, int, size_t);
static const wchar_t wc = L'1';
static const wchar_t ws1[] = L"1";
-static const wchar_t wsx[] = L"\x12345678";
-static const wchar_t ws4[] = L"\x00123456\x12005678\x12340078\x12345600";
+static const wchar_t wsx[] = L"\x12345678"; /* { dg-warning "hex escape" "" { target { ! 4byte_wchar_t } } } */
+static const wchar_t ws4[] = L"\x00123456\x12005678\x12340078\x12345600"; /* { dg-warning "hex escape" "" { target { ! 4byte_wchar_t } } } */
void test_wide (void)
{
@@ -47,7 +47,7 @@ void test_wide (void)
ELIM (memchr (L"" + 1, 0, 0) == 0);
ELIM (memchr (&wc + 1, 0, 0) == 0);
- ELIM (memchr (L"\x12345678", 0, sizeof (wchar_t)) == 0);
+ ELIM (memchr (L"\x12345678", 0, sizeof (wchar_t)) == 0); /* { dg-warning "hex escape" "" { target { ! 4byte_wchar_t } } } */
const size_t nb = sizeof ws4;
const size_t nwb = sizeof (wchar_t);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [committed] Handle targets with 2 byte wchar_t better in strlenopt-58.c
2018-12-05 19:13 ` Jeff Law
@ 2018-12-05 20:18 ` Martin Sebor
0 siblings, 0 replies; 4+ messages in thread
From: Martin Sebor @ 2018-12-05 20:18 UTC (permalink / raw)
To: Jeff Law, David Edelsohn; +Cc: GCC Patches
On 12/5/18 12:13 PM, Jeff Law wrote:
> On 12/5/18 11:59 AM, David Edelsohn wrote:
>> Jeff,
>>
>> Thanks for the patch.
>>
>> I continue to see a failure on AIX 32 bit mode (2 byte wchar).
>>
>> FAIL: gcc.dg/strlenopt-58.c scan-tree-dump-times optimized
>> "call_in_true_branch_not_eliminated" 0
>>
>> I'm not certain if this is AIX-specific or more fallout from wchar
>> size. I could ignore with target powerpc-ibm-aix* or with target !
>> 4byte_wchar_t.
>>
>> Any further insight / preference?
> I didn't try to address that specific failure yet -- my patch just fixed
> two earlier warnings.
>
> That specific failure either requires a deeper testsuite fix for
> possibly even a fix to the compiler -- I haven't really analyzed it yet
> (it's a failure to optimize issue and I've generally avoided looking at
> those).
>
>
> You could xfail it on 4byte_wchar_t.
I fixed similar failures in gcc.c-torture/execute/memchr-1.c some
time ago by adjusting the test (r265020) so I suspect something
along those lines would work here as well if we would rather avoid
XFAILing it.
Martin
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [committed] Handle targets with 2 byte wchar_t better in strlenopt-58.c
2018-12-05 18:59 David Edelsohn
@ 2018-12-05 19:13 ` Jeff Law
2018-12-05 20:18 ` Martin Sebor
0 siblings, 1 reply; 4+ messages in thread
From: Jeff Law @ 2018-12-05 19:13 UTC (permalink / raw)
To: David Edelsohn; +Cc: GCC Patches
On 12/5/18 11:59 AM, David Edelsohn wrote:
> Jeff,
>
> Thanks for the patch.
>
> I continue to see a failure on AIX 32 bit mode (2 byte wchar).
>
> FAIL: gcc.dg/strlenopt-58.c scan-tree-dump-times optimized
> "call_in_true_branch_not_eliminated" 0
>
> I'm not certain if this is AIX-specific or more fallout from wchar
> size. I could ignore with target powerpc-ibm-aix* or with target !
> 4byte_wchar_t.
>
> Any further insight / preference?
I didn't try to address that specific failure yet -- my patch just fixed
two earlier warnings.
That specific failure either requires a deeper testsuite fix for
possibly even a fix to the compiler -- I haven't really analyzed it yet
(it's a failure to optimize issue and I've generally avoided looking at
those).
You could xfail it on 4byte_wchar_t.
jeff
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [committed] Handle targets with 2 byte wchar_t better in strlenopt-58.c
@ 2018-12-05 18:59 David Edelsohn
2018-12-05 19:13 ` Jeff Law
0 siblings, 1 reply; 4+ messages in thread
From: David Edelsohn @ 2018-12-05 18:59 UTC (permalink / raw)
To: Jeffrey Law; +Cc: GCC Patches
Jeff,
Thanks for the patch.
I continue to see a failure on AIX 32 bit mode (2 byte wchar).
FAIL: gcc.dg/strlenopt-58.c scan-tree-dump-times optimized
"call_in_true_branch_not_eliminated" 0
I'm not certain if this is AIX-specific or more fallout from wchar
size. I could ignore with target powerpc-ibm-aix* or with target !
4byte_wchar_t.
Any further insight / preference?
Thanks, David
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-12-05 20:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-04 23:23 [committed] Handle targets with 2 byte wchar_t better in strlenopt-58.c Jeff Law
2018-12-05 18:59 David Edelsohn
2018-12-05 19:13 ` Jeff Law
2018-12-05 20:18 ` Martin Sebor
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).