mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-05 13:51:00 +08:00
predcom-1.c (count_averages): Avoid overflow during addition if an int is only 16 bits wide.
* 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. From-SVN: r126908
This commit is contained in:
parent
ba6cb9d268
commit
3c72bf3495
@ -1,3 +1,9 @@
|
||||
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
|
||||
|
@ -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)
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
void abort (void);
|
||||
|
||||
int fib[1000];
|
||||
long int fib[1000];
|
||||
|
||||
void count_fib(void)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user