summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorrask <rask@138bc75d-0d04-0410-961f-82ee72b054a4>2007-07-25 11:13:41 +0000
committerrask <rask@138bc75d-0d04-0410-961f-82ee72b054a4>2007-07-25 11:13:41 +0000
commit65d2fe43e62f6c1918df62bcc01f8c74af5d88ac (patch)
tree39b9a5669d95f92e365f7de8ad447f8b7ea2e79c /gcc
parent7b4faed5a8d61123b83da38afddfecd7a034ff14 (diff)
downloadgcc-65d2fe43e62f6c1918df62bcc01f8c74af5d88ac.tar.gz
* gcc.dg/tree-ssa/predcom-1.c (count_averages): Avoid overflow
during addition if an int is only 16 bits wide. * gcc.dg/tree-ssa/predcom-2.c (fib): Avoid overflow of 16-bit int. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@126908 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/predcom-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/predcom-2.c2
3 files changed, 8 insertions, 2 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 057c0ca873c..d7ab831b934 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,11 @@
2007-07-25 Rask Ingemann Lambertsen <rask@sygehus.dk>
+ * gcc.dg/tree-ssa/predcom-1.c (count_averages): Avoid overflow
+ during addition if an int is only 16 bits wide.
+ * gcc.dg/tree-ssa/predcom-2.c (fib): Avoid overflow of 16-bit int.
+
+2007-07-25 Rask Ingemann Lambertsen <rask@sygehus.dk>
+
* gcc.dg/torture/pr29584.c: Only run test if pointers have the same
size as "long int" and are 32 or 64 bits wide.
* gcc.dg/torture/pr28814.c: Likewise.
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/predcom-1.c b/gcc/testsuite/gcc.dg/tree-ssa/predcom-1.c
index 8e6e897199d..584f9eb0231 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/predcom-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/predcom-1.c
@@ -23,7 +23,7 @@ void count_averages(int n)
int i;
for (i = 1; i < n; i++)
- avg[i] = ((fib[i - 1] + fib[i] + fib[i + 1]) / 3) & 0xffff;
+ avg[i] = (((unsigned long) fib[i - 1] + fib[i] + fib[i + 1]) / 3) & 0xffff;
}
int main(void)
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/predcom-2.c b/gcc/testsuite/gcc.dg/tree-ssa/predcom-2.c
index b7088c5f83f..3ad13eaeda0 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/predcom-2.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/predcom-2.c
@@ -4,7 +4,7 @@
void abort (void);
-int fib[1000];
+long int fib[1000];
void count_fib(void)
{