public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [testsuite] Port 2 testcases from redhat/gcc-4_4-branch
@ 2009-10-18 19:44 Jakub Jelinek
  2009-10-19 15:42 ` Richard Henderson
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2009-10-18 19:44 UTC (permalink / raw)
  To: Janis Johnson; +Cc: gcc-patches

Hi!

These two testcases were added to redhat/gcc-4_4-branch together with a fix
that was deemed to be needed only for VTA 4.4 backport.  But IMHO it makes
sense to add the testcases from it to the trunk anyway.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2009-10-18  Jakub Jelinek  <jakub@redhat.com>

	Port from redhat/gcc-4_4-branch:
	2009-10-08  Jakub Jelinek  <jakub@redhat.com>
	* gcc.dg/debug/vta-2.c: New test.

	2009-09-30  Alexandre Oliva  <aoliva@redhat.com>
	* gcc.dg/debug/vta-1.c: New.

--- gcc/testsuite/gcc.dg/debug/vta-1.c.jj	2009-10-18 14:45:47.000000000 +0200
+++ gcc/testsuite/gcc.dg/debug/vta-1.c	2009-10-18 14:46:48.000000000 +0200
@@ -0,0 +1,34 @@
+/* https://bugzilla.redhat.com/show_bug.cgi?id=521991#c5
+
+   Distilled from Linux XFS source code.  foo, inlined into bar, ends
+   up with debug stmts referencing the addressable variable b.
+   Optimization made it non-addressable, and then completely optimized
+   away, before we got a chance to rename (and discard) the occurrence
+   in the debug stmt.  When we did, we crashed, attempting to rename
+   an unreference variable.  */
+
+/* { dg-do compile } */
+
+static inline int
+foo (void *x, unsigned y)
+{
+  unsigned z = *(unsigned long *) x % y;
+  *(unsigned long *) x = *(unsigned long *) x / y;
+  return z;
+}
+
+struct S
+{
+  unsigned t;
+};
+
+void
+bar (struct S *x, int *y)
+{
+  int a = 0;
+  unsigned long b = x->t;
+  foo (&b, x->t);
+  for (;; a++)
+    if (b)
+      *y = 1;
+}
--- gcc/testsuite/gcc.dg/debug/vta-2.c.jj	2009-10-18 14:45:50.000000000 +0200
+++ gcc/testsuite/gcc.dg/debug/vta-2.c	2009-10-18 14:46:54.000000000 +0200
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+
+static int
+bar (void *a, unsigned int b, int n)
+{
+  int c = *(unsigned long *) a % b;
+  *(unsigned long *) a = (int) (*(unsigned long *) a) / b;
+  return c;
+}
+
+int
+foo (unsigned long x, int *y, int z)
+{
+  int level;
+  for (level = 0; level < *y; level++)
+    {
+      bar (&x, z, sizeof (x));
+      if (x)
+	return *y - 1;
+    }
+}

	Jakub

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

* Re: [testsuite] Port 2 testcases from redhat/gcc-4_4-branch
  2009-10-18 19:44 [testsuite] Port 2 testcases from redhat/gcc-4_4-branch Jakub Jelinek
@ 2009-10-19 15:42 ` Richard Henderson
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 2009-10-19 15:42 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Janis Johnson, gcc-patches

On 10/18/2009 12:22 PM, Jakub Jelinek wrote:
> 	Port from redhat/gcc-4_4-branch:
> 	2009-10-08  Jakub Jelinek<jakub@redhat.com>
> 	* gcc.dg/debug/vta-2.c: New test.
>
> 	2009-09-30  Alexandre Oliva<aoliva@redhat.com>
> 	* gcc.dg/debug/vta-1.c: New.

Ok.


r~

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

end of thread, other threads:[~2009-10-19 15:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-18 19:44 [testsuite] Port 2 testcases from redhat/gcc-4_4-branch Jakub Jelinek
2009-10-19 15:42 ` Richard Henderson

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