diff options
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/loop.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/overflow-1.c | 25 |
4 files changed, 37 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c37ec9b..ade64d8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2003-12-07 Eric Botcazou <ebotcazou@libertysurf.fr> + PR optimization/13318 + * loop.c (express_from): Protect integer division from overflow. + +2003-12-07 Eric Botcazou <ebotcazou@libertysurf.fr> + PR optimization/13060 * function.c (fixup_var_refs_1) [SUBREG]: Recognize even if a replacement already exists. Fix again the whole insn if that fails. @@ -7196,6 +7196,9 @@ express_from (struct induction *g1, struct induction *g2) && GET_CODE (g2->mult_val) == CONST_INT) { if (g1->mult_val == const0_rtx + || (g1->mult_val == constm1_rtx + && INTVAL (g2->mult_val) + == (HOST_WIDE_INT) 1 << (HOST_BITS_PER_WIDE_INT - 1)) || INTVAL (g2->mult_val) % INTVAL (g1->mult_val) != 0) return NULL_RTX; mult = GEN_INT (INTVAL (g2->mult_val) / INTVAL (g1->mult_val)); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3e1be98..b075f0e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2003-12-07 Wolfgang Bangerth <bangerth@dealii.org> + + * gcc.dg/overflow-1.c: New test. + 2003-12-07 Eric Botcazou <ebotcazou@libertysurf.fr> * g77.f-torture/compile/13060.f: New test. diff --git a/gcc/testsuite/gcc.dg/overflow-1.c b/gcc/testsuite/gcc.dg/overflow-1.c new file mode 100644 index 0000000..db51a5e --- /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); + } +} |