From a16d8734b4f365cfbdd1147fe45f1333f710f85a Mon Sep 17 00:00:00 2001 From: ebotcazou Date: Sun, 7 Dec 2003 12:57:13 +0000 Subject: PR optimization/13318 * loop.c (express_from): Protect integer division from overflow. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@74387 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/gcc.dg/overflow-1.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/overflow-1.c (limited to 'gcc/testsuite/gcc.dg/overflow-1.c') diff --git a/gcc/testsuite/gcc.dg/overflow-1.c b/gcc/testsuite/gcc.dg/overflow-1.c new file mode 100644 index 00000000000..db51a5ef129 --- /dev/null +++ b/gcc/testsuite/gcc.dg/overflow-1.c @@ -0,0 +1,25 @@ +/* PR optimization/13318 */ +/* Origin: */ +/* Reduced testcase: Wolfgang Bangerth */ + +/* 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); + } +} -- cgit v1.2.1