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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [gcc.dg/] [uninit-8-O0.c] - Diff between revs 298 and 338

Only display areas with differences | Details | Blame | View Log

Rev 298 Rev 338
/* 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 "-Wuninitialized" } */
/* { dg-options "-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;
    }
    }
}
}
 
 

powered by: WebSVN 2.1.0

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