public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Janis Johnson <janis187@us.ibm.com>
Cc: gcc-patches@gcc.gnu.org
Subject: [testsuite] Port 2 testcases from redhat/gcc-4_4-branch
Date: Sun, 18 Oct 2009 19:44:00 -0000	[thread overview]
Message-ID: <20091018192246.GY14664@tyan-ft48-01.lab.bos.redhat.com> (raw)

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

             reply	other threads:[~2009-10-18 19:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-18 19:44 Jakub Jelinek [this message]
2009-10-19 15:42 ` Richard Henderson

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=20091018192246.GY14664@tyan-ft48-01.lab.bos.redhat.com \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=janis187@us.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).