summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/pr24851.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/execute/pr24851.c')
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr24851.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr24851.c b/gcc/testsuite/gcc.c-torture/execute/pr24851.c
new file mode 100644
index 000000000..55a87e001
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr24851.c
@@ -0,0 +1,17 @@
+/* We used to handle pointer addition wrongly
+ at the time of recombining to an ARRAY_REF
+ in the case of
+ p + -4B
+ where -4B is represented as unsigned. */
+
+void abort(void);
+int main()
+{
+ int a[10], *p, *q;
+ q = &a[1];
+ p = &q[-1];
+ if (p >= &a[9])
+ abort ();
+ return 0;
+}
+