diff mbox series

RISC-V: Revive test case PR 102957

Message ID 3aa13843de038d960fdb3415f416243e43b376f2.1691745095.git.research_trasio@irq.a4lg.com
State New
Headers show
Series RISC-V: Revive test case PR 102957 | expand

Commit Message

Tsukasa OI Aug. 11, 2023, 9:11 a.m. UTC
From: Tsukasa OI <research_trasio@irq.a4lg.com>

Commit c283c4774d1c ("RISC-V: Throw compilation error for unknown
extensions") changed how do we handle unknown extensions and
commit 6f709f79c915a ("[committed] [RISC-V] Fix expected diagnostic messages
in testsuite") "fixed" test failures caused by that change (on pr102957.c,
by testing the error message after the first change).

However, the latter change will break the original intent of PR 102957 test
case because we wanted to make sure that we can parse a valid two-letter
extension name.

Fortunately, there is a valid two-letter extension name, 'Zk' (standard
scalar cryptography extension superset with NIST algorithm suite).

This commit puts this extension name and revives the intent of the test case
for PR 102957.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/pr102957.c: Remove "dg-error" because we don't
	need to test for error message.  Use the 'Zk' extension to continue
	testing whether we can use valid two-letter extensions.
---
 gcc/testsuite/gcc.target/riscv/pr102957.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)


base-commit: bcda361daaec8623c91d0dff3ea8e576373b5f50

Comments

Jeff Law Aug. 11, 2023, 2:15 p.m. UTC | #1
On 8/11/23 03:11, Tsukasa OI via Gcc-patches wrote:
> From: Tsukasa OI <research_trasio@irq.a4lg.com>
> 
> Commit c283c4774d1c ("RISC-V: Throw compilation error for unknown
> extensions") changed how do we handle unknown extensions and
> commit 6f709f79c915a ("[committed] [RISC-V] Fix expected diagnostic messages
> in testsuite") "fixed" test failures caused by that change (on pr102957.c,
> by testing the error message after the first change).
> 
> However, the latter change will break the original intent of PR 102957 test
> case because we wanted to make sure that we can parse a valid two-letter
> extension name.
> 
> Fortunately, there is a valid two-letter extension name, 'Zk' (standard
> scalar cryptography extension superset with NIST algorithm suite).
> 
> This commit puts this extension name and revives the intent of the test case
> for PR 102957.
> 
> gcc/testsuite/ChangeLog:
> 
> 	* gcc.target/riscv/pr102957.c: Remove "dg-error" because we don't
> 	need to test for error message.  Use the 'Zk' extension to continue
> 	testing whether we can use valid two-letter extensions.
This doesn't look right to me.  The whole point of this specific dg line 
is to verify that we get an error with an invalid extension specification.

What might make more sense would be to split this into two tests.  One 
which continues to test that we get an error for something like zb and 
the other with everything else.

jeff
Tsukasa OI Aug. 11, 2023, 2:29 p.m. UTC | #2
On 2023/08/11 23:15, Jeff Law wrote:
> 
> 
> On 8/11/23 03:11, Tsukasa OI via Gcc-patches wrote:
>> From: Tsukasa OI <research_trasio@irq.a4lg.com>
>>
>> Commit c283c4774d1c ("RISC-V: Throw compilation error for unknown
>> extensions") changed how do we handle unknown extensions and
>> commit 6f709f79c915a ("[committed] [RISC-V] Fix expected diagnostic
>> messages
>> in testsuite") "fixed" test failures caused by that change (on
>> pr102957.c,
>> by testing the error message after the first change).
>>
>> However, the latter change will break the original intent of PR 102957
>> test
>> case because we wanted to make sure that we can parse a valid two-letter
>> extension name.
>>
>> Fortunately, there is a valid two-letter extension name, 'Zk' (standard
>> scalar cryptography extension superset with NIST algorithm suite).
>>
>> This commit puts this extension name and revives the intent of the
>> test case
>> for PR 102957.
>>
>> gcc/testsuite/ChangeLog:
>>
>>     * gcc.target/riscv/pr102957.c: Remove "dg-error" because we don't
>>     need to test for error message.  Use the 'Zk' extension to continue
>>     testing whether we can use valid two-letter extensions.
> This doesn't look right to me.  The whole point of this specific dg line
> is to verify that we get an error with an invalid extension specification.
> 
> What might make more sense would be to split this into two tests.  One
> which continues to test that we get an error for something like zb and
> the other with everything else.
> 
> jeff
> 

Originally, it tested that a two letter extension ('Zb') is accepted by
GCC (because the background of PR 102957 was GCC assumed multi-letter
'Z' extensions are three letters or more).

After rejecting unrecognized extensions, "dg-error" is added **just to
avoid the test failure** and that doesn't look right.  Yes, we now don't
have an ICE (like in the original report) but after the PR 102957 fix,
we just accepted it, not rejecting it.

Instead, we have a valid (recognized) two-letter 'Z' extension: 'Zk'.  I
think replacing "zb" with "zk" is more correct considering the original
bug report (PR 102957) and its assumption.

cf. <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102957>

Regards,
Tsukasa
Jeff Law Aug. 28, 2023, 10:01 p.m. UTC | #3
On 8/11/23 08:29, Tsukasa OI wrote:
> On 2023/08/11 23:15, Jeff Law wrote:

>>
> 
> Originally, it tested that a two letter extension ('Zb') is accepted by
> GCC (because the background of PR 102957 was GCC assumed multi-letter
> 'Z' extensions are three letters or more).
> 
> After rejecting unrecognized extensions, "dg-error" is added **just to
> avoid the test failure** and that doesn't look right.  Yes, we now don't
> have an ICE (like in the original report) but after the PR 102957 fix,
> we just accepted it, not rejecting it.
> 
> Instead, we have a valid (recognized) two-letter 'Z' extension: 'Zk'.  I
> think replacing "zb" with "zk" is more correct considering the original
> bug report (PR 102957) and its assumption.
> 
> cf. <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102957>
Thanks.  It still seems to me we want to  have two tests here.

I would suggest leaving pr102957.c alone since that tests that we give a 
proper error for "zb".  Then create a new test that verifies "zk" is 
accepted without error.

jeff
Tsukasa OI Aug. 29, 2023, 2:12 a.m. UTC | #4
On 2023/08/29 7:01, Jeff Law wrote:
> 
> 
> On 8/11/23 08:29, Tsukasa OI wrote:
>> On 2023/08/11 23:15, Jeff Law wrote:
> 
>>>
>>
>> Originally, it tested that a two letter extension ('Zb') is accepted by
>> GCC (because the background of PR 102957 was GCC assumed multi-letter
>> 'Z' extensions are three letters or more).
>>
>> After rejecting unrecognized extensions, "dg-error" is added **just to
>> avoid the test failure** and that doesn't look right.  Yes, we now don't
>> have an ICE (like in the original report) but after the PR 102957 fix,
>> we just accepted it, not rejecting it.
>>
>> Instead, we have a valid (recognized) two-letter 'Z' extension: 'Zk'.  I
>> think replacing "zb" with "zk" is more correct considering the original
>> bug report (PR 102957) and its assumption.
>>
>> cf. <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102957>
> Thanks.  It still seems to me we want to  have two tests here.
> 
> I would suggest leaving pr102957.c alone since that tests that we give a
> proper error for "zb".  Then create a new test that verifies "zk" is
> accepted without error.
> 
> jeff
> 

Okay, that's a great compromise.

I will make v2 to add pr102957-2.c (like so) to reflect my intention and
keep the original pr102957.c.

Thanks,
Tsukasa
diff mbox series

Patch

diff --git a/gcc/testsuite/gcc.target/riscv/pr102957.c b/gcc/testsuite/gcc.target/riscv/pr102957.c
index 5273ee6c5018..fe6241466354 100644
--- a/gcc/testsuite/gcc.target/riscv/pr102957.c
+++ b/gcc/testsuite/gcc.target/riscv/pr102957.c
@@ -1,7 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-march=rv64gzb -mabi=lp64" } */
+/* { dg-options "-march=rv64gzk -mabi=lp64" } */
 int foo()
 {
 }
-
-/* { dg-error "extension 'zb' starts with 'z' but is unsupported standard extension" "" { target *-*-* } 0 } */