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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* Spurious uninitialized variable warnings.  Slight variant on the
2
   documented case, inspired by reg-stack.c:record_asm_reg_life.  */
3
 
4
/* { dg-do compile } */
5
/* { dg-options "-Wuninitialized" } */
6
 
7
struct foo
8
{
9
    int type;
10
    struct foo *car;
11
    struct foo *cdr;
12
    char *data;
13
    int data2;
14
};
15
 
16
extern void use(struct foo *);
17
 
18
#define CLOBBER 6
19
#define PARALLEL 3
20
 
21
void
22
func(struct foo *list, int count)
23
{
24
    int n_clobbers = 0;
25
    int i;
26
    struct foo **clob_list;   /* { dg-bogus "clob_list" "uninitialized variable warning" } */
27
 
28
    if(list[0].type == PARALLEL)
29
    {
30
        clob_list = __builtin_alloca(count * sizeof(struct foo *));
31
 
32
        for(i = 1; i < count; i++)
33
        {
34
            if(list[i].type == CLOBBER)
35
                clob_list[n_clobbers++] = &list[i];
36
        }
37
    }
38
 
39
    for(i = 0; i < n_clobbers; i++)
40
        use(clob_list[i]);
41
}

powered by: WebSVN 2.1.0

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