diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-11-17 11:35:00 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-11-17 11:35:00 +0000 |
commit | 148ad152f2f6dad3160819dc6f471080d801d313 (patch) | |
tree | fa01127a0e850334616461c97e66569538042b89 /gcc/testsuite/gcc.c-torture/execute/pr24851.c | |
parent | 3eef7b639006d074108fa13492583e7d40e4b909 (diff) | |
download | gcc-148ad152f2f6dad3160819dc6f471080d801d313.tar.gz |
2005-11-16 Richard Guenther <rguenther@suse.de>
PR middle-end/24851
* fold-const.c (extract_array_ref): Return byte offset
in all cases.
(fold_binary): Fold &x[a] CMP &x[b] to
a*sizeof(*x) CMP b*sizeof(*x) to get correct overflow
behavior.
* gcc.c-torture/execute/pr24851.c: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@107117 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/execute/pr24851.c')
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/pr24851.c | 17 |
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 00000000000..55a87e0019e --- /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; +} + |