From: Richard Guenther <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] New testcase
Date: Thu, 22 May 2008 16:55:00 -0000 [thread overview]
Message-ID: <Pine.LNX.4.64.0805221631180.4039@zhemvz.fhfr.qr> (raw)
While trying to work on PR36291.
Committed as obvious.
Richard.
2008-05-22 Richard Guenther <rguenther@suse.de>
* gcc.c-torture/execute/20080522-1.c: New testcase.
Index: testsuite/gcc.c-torture/execute/20080522-1.c
===================================================================
--- testsuite/gcc.c-torture/execute/20080522-1.c (revision 0)
+++ testsuite/gcc.c-torture/execute/20080522-1.c (revision 0)
@@ -0,0 +1,43 @@
+/* This testcase is to make sure we have i in referenced vars and that we
+ properly compute aliasing for the loads and stores. */
+
+extern void abort (void);
+
+static int i;
+static int *p = &i;
+
+int __attribute__((noinline))
+foo(int *q)
+{
+ *p = 1;
+ *q = 2;
+ return *p;
+}
+
+int __attribute__((noinline))
+bar(int *q)
+{
+ *q = 2;
+ *p = 1;
+ return *q;
+}
+
+int main()
+{
+ int j = 0;
+
+ if (foo(&i) != 2)
+ abort ();
+ if (bar(&i) != 1)
+ abort ();
+ if (foo(&j) != 1)
+ abort ();
+ if (j != 2)
+ abort ();
+ if (bar(&j) != 2)
+ abort ();
+ if (j != 2)
+ abort ();
+
+ return 0;
+}
next reply other threads:[~2008-05-22 14:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-22 16:55 Richard Guenther [this message]
2009-10-20 16:00 Richard Guenther
2012-06-15 11:43 Richard Guenther
2023-03-14 7:29 Richard Biener
[not found] <20230314072924.C1A34385840C@sourceware.org>
2023-03-20 10:15 ` Jakub Jelinek
2023-03-20 10:59 ` Richard Biener
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=Pine.LNX.4.64.0805221631180.4039@zhemvz.fhfr.qr \
--to=rguenther@suse.de \
--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).