summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/overflow-1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/overflow-1.c')
-rw-r--r--gcc/testsuite/gcc.dg/overflow-1.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/overflow-1.c b/gcc/testsuite/gcc.dg/overflow-1.c
new file mode 100644
index 000000000..db51a5ef1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/overflow-1.c
@@ -0,0 +1,25 @@
+/* PR optimization/13318 */
+/* Origin: <bremner@unb.ca> */
+/* Reduced testcase: Wolfgang Bangerth <bangerth@dealii.org> */
+
+/* Verify that the big multiplier doesn't cause an integer
+ overflow in the loop optimizer. */
+
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+struct S {
+ int key;
+ int rnext,rprev;
+};
+
+void foo(struct S* H)
+{
+ int i, k;
+ for (i=0; i<2; i++){
+ struct S* cell=H+k;
+ cell->key=i*(0xffffffffUL/2);
+ cell->rnext=k+(1-i);
+ cell->rprev=k+(1-i);
+ }
+}