public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew Pinski <apinski@marvell.com>
To: <gcc-patches@gcc.gnu.org>
Cc: Andrew Pinski <apinski@marvell.com>
Subject: [COMMITTED] Fix 110803: use of plain char instead of signed char
Date: Tue, 25 Jul 2023 14:55:34 -0700	[thread overview]
Message-ID: <20230725215534.1791062-1-apinski@marvell.com> (raw)

So the problem here is that plain char can either be signed
or unsigned depending on the target (powerpc and aarch64 are
unsigned while most other targets are signed). So the testcase
gcc.c-torture/execute/pr109986.c was assuming plain char was signed
char which is wrong so it is better to just change the `char` to be
`signed char`.
Note gcc.c-torture/execute/pr109986.c includes gcc.dg/tree-ssa/pr109986.c
where the plain char was being used.

Committed as obvious after a quick test to make sure gcc.c-torture/execute/pr109986.c
now passes and gcc.dg/tree-ssa/pr109986.c still passes.

gcc/testsuite/ChangeLog:

	PR testsuite/110803
	* gcc.dg/tree-ssa/pr109986.c: Change plain char to be
	`signed char`.
---
 gcc/testsuite/gcc.dg/tree-ssa/pr109986.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr109986.c b/gcc/testsuite/gcc.dg/tree-ssa/pr109986.c
index 45f099b5656..0724510e5d5 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr109986.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr109986.c
@@ -16,14 +16,14 @@ t2 (int a, int b)
   return a ^ (~a | (unsigned int) b);
 }
 
-__attribute__((noipa)) char
-t3 (char a, char b)
+__attribute__((noipa)) signed char
+t3 (signed char a, signed char b)
 {
   return (b | ~a) ^ a;
 }
 
 __attribute__((noipa)) unsigned char
-t4 (char a, char b)
+t4 (signed char a, signed char b)
 {
   return ((unsigned char) a) ^ (b | ~a);
 }
@@ -89,20 +89,20 @@ t12 (int a, unsigned int b)
   return t3;
 }
 
-__attribute__((noipa)) char
-t13 (char a, char b)
+__attribute__((noipa)) signed char
+t13 (signed char a, signed char b)
 {
-  char t1 = ~a;
-  char t2 = b | t1;
-  char t3 = t2 ^ a;
+  signed char t1 = ~a;
+  signed char t2 = b | t1;
+  signed char t3 = t2 ^ a;
   return t3;
 }
 
 __attribute__((noipa)) unsigned char
-t14 (unsigned char a, char b)
+t14 (unsigned char a, signed char b)
 {
   unsigned char t1 = ~a;
-  char t2 = b | t1;
+  signed char t2 = b | t1;
   unsigned char t3 = a ^ t2;
   return t3;
 }
-- 
2.31.1


                 reply	other threads:[~2023-07-25 21:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20230725215534.1791062-1-apinski@marvell.com \
    --to=apinski@marvell.com \
    --cc=gcc-patches@gcc.gnu.org \
    /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).