This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Testcases PR63184
- From: Richard Biener <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 5 Dec 2018 15:55:22 +0100 (CET)
- Subject: [PATCH] Testcases PR63184
Committed.
Richard.
2018-12-05 Richard Biener <rguenther@suse.de>
PR middle-end/63184
* c-c++-common/pr19807-2.c: New testcase.
* c-c++-common/pr19807-3.c: Likewise.
diff --git a/gcc/testsuite/c-c++-common/pr19807-2.c b/gcc/testsuite/c-c++-common/pr19807-2.c
new file mode 100644
index 00000000000..c8b2a57d654
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr19807-2.c
@@ -0,0 +1,12 @@
+/* { dg-do link } */
+/* { dg-options "-O" } */
+
+extern void link_error(void);
+int i;
+int main()
+{
+ int a[4];
+ if ((char*)&a[1] + 4*i + 4 != (char*)&a[i+2])
+ link_error();
+ return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/pr19807-3.c b/gcc/testsuite/c-c++-common/pr19807-3.c
new file mode 100644
index 00000000000..d882bd369bf
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr19807-3.c
@@ -0,0 +1,12 @@
+/* { dg-do link } */
+/* { dg-options "-O" } */
+
+extern void link_error(void);
+int i;
+int main()
+{
+ int a[4];
+ if (&a[1] + i + 1 != &a[i+2])
+ link_error();
+ return 0;
+}