OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc2/] [gcc/] [testsuite/] [gcc.dg/] [uninit-9.c] - Diff between revs 298 and 384

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 298 Rev 384
/* Spurious uninitialized variable warnings.  Slight variant on the
/* Spurious uninitialized variable warnings.  Slight variant on the
   documented case, inspired by reg-stack.c:record_asm_reg_life.  */
   documented case, inspired by reg-stack.c:record_asm_reg_life.  */
 
 
/* { dg-do compile } */
/* { dg-do compile } */
/* { dg-options "-O -Wuninitialized" } */
/* { dg-options "-O -Wuninitialized" } */
 
 
struct foo
struct foo
{
{
    int type;
    int type;
    struct foo *car;
    struct foo *car;
    struct foo *cdr;
    struct foo *cdr;
    char *data;
    char *data;
    int data2;
    int data2;
};
};
 
 
extern void use(struct foo *);
extern void use(struct foo *);
 
 
#define CLOBBER 6
#define CLOBBER 6
#define PARALLEL 3
#define PARALLEL 3
 
 
void
void
func(struct foo *list, int count)
func(struct foo *list, int count)
{
{
    int n_clobbers = 0;
    int n_clobbers = 0;
    int i;
    int i;
    struct foo **clob_list;   /* { dg-bogus "clob_list" "uninitialized variable warning" } */
    struct foo **clob_list;   /* { dg-bogus "clob_list" "uninitialized variable warning" } */
 
 
    if(list[0].type == PARALLEL)
    if(list[0].type == PARALLEL)
    {
    {
        clob_list = __builtin_alloca(count * sizeof(struct foo *));
        clob_list = __builtin_alloca(count * sizeof(struct foo *));
 
 
        for(i = 1; i < count; i++)
        for(i = 1; i < count; i++)
        {
        {
            if(list[i].type == CLOBBER)
            if(list[i].type == CLOBBER)
                clob_list[n_clobbers++] = &list[i];
                clob_list[n_clobbers++] = &list[i];
        }
        }
    }
    }
 
 
    for(i = 0; i < n_clobbers; i++)
    for(i = 0; i < n_clobbers; i++)
        use(clob_list[i]);
        use(clob_list[i]);
}
}
 
 

powered by: WebSVN 2.1.0

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