OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [uninit-8.c] - Blame information for rev 689

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* Uninitialized variable warning tests...
2
   Inspired by part of optabs.c:expand_binop.
3
   May be the same as uninit-1.c.  */
4
 
5
/* { dg-do compile } */
6
/* { dg-options "-O -Wuninitialized" } */
7
 
8
#include <limits.h>
9
 
10
void
11
add_bignums (int *out, int *x, int *y)
12
{
13
    int p, sum;
14
    int carry; /* { dg-bogus "carry" "uninitialized variable warning" } */
15
 
16
    p = 0;
17
    for (; *x; x++, y++, out++, p++)
18
    {
19
        if (p)
20
            sum = *x + *y + carry;
21
        else
22
            sum = *x + *y;
23
 
24
        if (sum < 0)
25
        {
26
            carry = 1;
27
            sum -= INT_MAX;
28
        }
29
        else
30
            carry = 0;
31
    }
32
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.