public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jiufu Guo <guojiufu@linux.ibm.com>
To: gcc-patches@gcc.gnu.org
Cc: segher@kernel.crashing.org, dje.gcc@gmail.com, linkw@gcc.gnu.org,
	bergner@linux.ibm.com, guojiufu@linux.ibm.com,
	uweigand@de.ibm.com, krebbel@linux.ibm.com, pinskia@gcc.gnu.org,
	rguenther@suse.de, jeffreyalaw@gmail.com
Subject: [PATCH] s390: avoid peeking eof after __vector
Date: Wed, 27 Mar 2024 14:36:14 +0800	[thread overview]
Message-ID: <20240327063614.2444325-1-guojiufu@linux.ibm.com> (raw)

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
-- 
2.25.1


             reply	other threads:[~2024-03-27  6:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-27  6:36 Jiufu Guo [this message]
2024-04-17  1:52 ` Jiufu Guo
2024-04-17  6:09   ` Andreas Krebbel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240327063614.2444325-1-guojiufu@linux.ibm.com \
    --to=guojiufu@linux.ibm.com \
    --cc=bergner@linux.ibm.com \
    --cc=dje.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jeffreyalaw@gmail.com \
    --cc=krebbel@linux.ibm.com \
    --cc=linkw@gcc.gnu.org \
    --cc=pinskia@gcc.gnu.org \
    --cc=rguenther@suse.de \
    --cc=segher@kernel.crashing.org \
    --cc=uweigand@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).