s390: avoid peeking eof after __vector

Message ID 20240327063614.2444325-1-guojiufu@linux.ibm.com
State New
Headers
Series s390: avoid peeking eof after __vector |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gcc_check--master-arm success Testing passed

Commit Message

Jiufu Guo March 27, 2024, 6:36 a.m. UTC
  Hi,

Same like PR101168, this patch is need for s390 to
avoid peeking eof after vector keyword.
And similar test case is also ok for s390.

Is this ok for trunk?

Jeff (Jiufu Guo)

	PR target/95782

gcc/ChangeLog:

	* config/s390/s390-c.cc (s390_macro_to_expand): Avoid empty identifier.

gcc/testsuite/ChangeLog:

	* g++.target/s390/pr95782.C: New test.

---
 gcc/config/s390/s390-c.cc               | 4 +++-
 gcc/testsuite/g++.target/s390/pr95782.C | 5 +++++
 2 files changed, 8 insertions(+), 1 deletion(-)
 create mode 100644 gcc/testsuite/g++.target/s390/pr95782.C
  

Comments

Jiufu Guo April 17, 2024, 1:52 a.m. UTC | #1
Hi,

I would like to ping this patch.


Jeff (Jiufu Guo)

Jiufu Guo <guojiufu@linux.ibm.com> writes:

> Hi,
>
> Same like PR101168, this patch is need for s390 to
> avoid peeking eof after vector keyword.
> And similar test case is also ok for s390.
>
> Is this ok for trunk?
>
> Jeff (Jiufu Guo)
>
> 	PR target/95782
>
> gcc/ChangeLog:
>
> 	* config/s390/s390-c.cc (s390_macro_to_expand): Avoid empty identifier.
>
> gcc/testsuite/ChangeLog:
>
> 	* g++.target/s390/pr95782.C: New test.
>
> ---
>  gcc/config/s390/s390-c.cc               | 4 +++-
>  gcc/testsuite/g++.target/s390/pr95782.C | 5 +++++
>  2 files changed, 8 insertions(+), 1 deletion(-)
>  create mode 100644 gcc/testsuite/g++.target/s390/pr95782.C
>
> diff --git a/gcc/config/s390/s390-c.cc b/gcc/config/s390/s390-c.cc
> index 8d3d1a467a8..45f164d978b 100644
> --- a/gcc/config/s390/s390-c.cc
> +++ b/gcc/config/s390/s390-c.cc
> @@ -275,7 +275,9 @@ s390_macro_to_expand (cpp_reader *pfile, const cpp_token *tok)
>        /* __vector long __bool a; */
>        if (ident == C_CPP_HASHNODE (__bool_keyword))
>  	expand_bool_p = true;
> -      else
> +
> +      /* If there are more tokens to check.  */
> +      else if (ident)
>  	{
>  	  /* Triggered with: __vector long long __bool a; */
>  	  do
> diff --git a/gcc/testsuite/g++.target/s390/pr95782.C b/gcc/testsuite/g++.target/s390/pr95782.C
> new file mode 100644
> index 00000000000..daf887fc6fe
> --- /dev/null
> +++ b/gcc/testsuite/g++.target/s390/pr95782.C
> @@ -0,0 +1,5 @@
> +// { dg-do compile }
> +// { dg-options "-march=z14 -mzvector" }
> +
> +using vdbl =  __vector double;
> +#define BREAK 1
  
Andreas Krebbel April 17, 2024, 6:09 a.m. UTC | #2
On 4/17/24 03:52, Jiufu Guo wrote:
> 
> Hi,
> 
> I would like to ping this patch.
> 
> 
> Jeff (Jiufu Guo)
> 
> Jiufu Guo <guojiufu@linux.ibm.com> writes:
> 
>> Hi,
>>
>> Same like PR101168, this patch is need for s390 to
>> avoid peeking eof after vector keyword.
>> And similar test case is also ok for s390.
>>
>> Is this ok for trunk?
>>
>> Jeff (Jiufu Guo)
>>
>> 	PR target/95782
>>
>> gcc/ChangeLog:
>>
>> 	* config/s390/s390-c.cc (s390_macro_to_expand): Avoid empty identifier.
>>
>> gcc/testsuite/ChangeLog:
>>
>> 	* g++.target/s390/pr95782.C: New test.

Sorry for the delay. This is ok. Thanks!

Andreas

>>
>> ---
>>  gcc/config/s390/s390-c.cc               | 4 +++-
>>  gcc/testsuite/g++.target/s390/pr95782.C | 5 +++++
>>  2 files changed, 8 insertions(+), 1 deletion(-)
>>  create mode 100644 gcc/testsuite/g++.target/s390/pr95782.C
>>
>> diff --git a/gcc/config/s390/s390-c.cc b/gcc/config/s390/s390-c.cc
>> index 8d3d1a467a8..45f164d978b 100644
>> --- a/gcc/config/s390/s390-c.cc
>> +++ b/gcc/config/s390/s390-c.cc
>> @@ -275,7 +275,9 @@ s390_macro_to_expand (cpp_reader *pfile, const cpp_token *tok)
>>        /* __vector long __bool a; */
>>        if (ident == C_CPP_HASHNODE (__bool_keyword))
>>  	expand_bool_p = true;
>> -      else
>> +
>> +      /* If there are more tokens to check.  */
>> +      else if (ident)
>>  	{
>>  	  /* Triggered with: __vector long long __bool a; */
>>  	  do
>> diff --git a/gcc/testsuite/g++.target/s390/pr95782.C b/gcc/testsuite/g++.target/s390/pr95782.C
>> new file mode 100644
>> index 00000000000..daf887fc6fe
>> --- /dev/null
>> +++ b/gcc/testsuite/g++.target/s390/pr95782.C
>> @@ -0,0 +1,5 @@
>> +// { dg-do compile }
>> +// { dg-options "-march=z14 -mzvector" }
>> +
>> +using vdbl =  __vector double;
>> +#define BREAK 1
  

Patch

diff --git a/gcc/config/s390/s390-c.cc b/gcc/config/s390/s390-c.cc
index 8d3d1a467a8..45f164d978b 100644
--- a/gcc/config/s390/s390-c.cc
+++ b/gcc/config/s390/s390-c.cc
@@ -275,7 +275,9 @@  s390_macro_to_expand (cpp_reader *pfile, const cpp_token *tok)
       /* __vector long __bool a; */
       if (ident == C_CPP_HASHNODE (__bool_keyword))
 	expand_bool_p = true;
-      else
+
+      /* If there are more tokens to check.  */
+      else if (ident)
 	{
 	  /* Triggered with: __vector long long __bool a; */
 	  do
diff --git a/gcc/testsuite/g++.target/s390/pr95782.C b/gcc/testsuite/g++.target/s390/pr95782.C
new file mode 100644
index 00000000000..daf887fc6fe
--- /dev/null
+++ b/gcc/testsuite/g++.target/s390/pr95782.C
@@ -0,0 +1,5 @@ 
+// { dg-do compile }
+// { dg-options "-march=z14 -mzvector" }
+
+using vdbl =  __vector double;
+#define BREAK 1