URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Go to most recent revision |
Only display areas with differences |
Details |
Blame |
View Log
Rev 154 |
Rev 816 |
/* Uninitialized variable warning tests...
|
/* Uninitialized variable warning tests...
|
Inspired by part of optabs.c:expand_binop.
|
Inspired by part of optabs.c:expand_binop.
|
May be the same as uninit-1.c. */
|
May be the same as uninit-1.c. */
|
|
|
/* { dg-do compile } */
|
/* { dg-do compile } */
|
/* { dg-options "-O -Wuninitialized" } */
|
/* { dg-options "-O -Wuninitialized" } */
|
|
|
#include <limits.h>
|
#include <limits.h>
|
|
|
void
|
void
|
add_bignums (int *out, int *x, int *y)
|
add_bignums (int *out, int *x, int *y)
|
{
|
{
|
int p, sum;
|
int p, sum;
|
int carry; /* { dg-bogus "carry" "uninitialized variable warning" } */
|
int carry; /* { dg-bogus "carry" "uninitialized variable warning" } */
|
|
|
p = 0;
|
p = 0;
|
for (; *x; x++, y++, out++, p++)
|
for (; *x; x++, y++, out++, p++)
|
{
|
{
|
if (p)
|
if (p)
|
sum = *x + *y + carry;
|
sum = *x + *y + carry;
|
else
|
else
|
sum = *x + *y;
|
sum = *x + *y;
|
|
|
if (sum < 0)
|
if (sum < 0)
|
{
|
{
|
carry = 1;
|
carry = 1;
|
sum -= INT_MAX;
|
sum -= INT_MAX;
|
}
|
}
|
else
|
else
|
carry = 0;
|
carry = 0;
|
}
|
}
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.