public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] testsuite: Fix up pr64536.c for LLP64 targets [PR108151]
@ 2022-12-19 14:07 Jakub Jelinek
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Jelinek @ 2022-12-19 14:07 UTC (permalink / raw)
  To: gcc-patches

Hi!

Apparently llp64 had 2 further warnings, fixed thusly.

Committed as obvious after testing it with cross to mingw.

2022-12-19  Jakub Jelinek  <jakub@redhat.com>

	PR testsuite/108151
	* gcc.dg/pr64536.c (bar): Cast long to __INTPTR_TYPE__
	before casting to long *.

--- gcc/testsuite/gcc.dg/pr64536.c.jj
+++ gcc/testsuite/gcc.dg/pr64536.c
@@ -40,7 +40,7 @@ bar (int x)
 	      h->q = *f;
 	    }
 	  else
-	    i = (long *) (h->q = *f);
+	    i = (long *) (__INTPTR_TYPE__) (h->q = *f);
 	  *c++ = (__INTPTR_TYPE__) f;
 	  e += 6;
 	}
@@ -54,7 +54,7 @@ bar (int x)
 	      h->q = *f;
 	    }
 	  else
-	    i = (long *) (h->q = *f);
+	    i = (long *) (__INTPTR_TYPE__) (h->q = *f);
 	  *c++ = (__INTPTR_TYPE__) f;
 	  e += 6;
 	}

	Jakub


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [committed] testsuite: Fix up pr64536.c for LLP64 targets [PR108151]
@ 2022-12-19 12:53 Jakub Jelinek
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Jelinek @ 2022-12-19 12:53 UTC (permalink / raw)
  To: gcc-patches

Hi!

The test casts a pointer to long, which is ok for ilp32 and lp64
targets but not for llp64 targets.  Nothing reads the values later,
it is a link test, so all we care about is that it is the same
cast on s390x-linux where it used to fail before the PR64536 fix,
and that we don't warn about it.

Tested on x86_64-linux -m32/-m64 and with a cross to s390x-linux,
committed to trunk as obvious.

2022-12-19  Jakub Jelinek  <jakub@redhat.com>

	PR testsuite/108151
	* gcc.dg/pr64536.c (bar): Use casts to __INTPTR_TYPE__ rather than
	long when casting pointer to integral type.

--- gcc/testsuite/gcc.dg/pr64536.c.jj	2020-01-12 11:54:37.489397175 +0100
+++ gcc/testsuite/gcc.dg/pr64536.c	2022-12-19 13:44:42.608091278 +0100
@@ -41,7 +41,7 @@ bar (int x)
 	    }
 	  else
 	    i = (long *) (h->q = *f);
-	  *c++ = (long) f;
+	  *c++ = (__INTPTR_TYPE__) f;
 	  e += 6;
 	}
       else
@@ -55,7 +55,7 @@ bar (int x)
 	    }
 	  else
 	    i = (long *) (h->q = *f);
-	  *c++ = (long) f;
+	  *c++ = (__INTPTR_TYPE__) f;
 	  e += 6;
 	}
     }

	Jakub


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-12-19 14:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-19 14:07 [committed] testsuite: Fix up pr64536.c for LLP64 targets [PR108151] Jakub Jelinek
  -- strict thread matches above, loose matches on Subject: below --
2022-12-19 12:53 Jakub Jelinek

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).