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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [20031215-1.c] - Blame information for rev 825

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* PR middle-end/13400 */
2
/* The following test used to fail at run-time with a write to read-only
3
   memory, caused by if-conversion converting a conditional write into an
4
   unconditional write.  */
5
 
6
typedef struct {int c, l; char ch[3];} pstr;
7
const pstr ao = {2, 2, "OK"};
8
const pstr * const a = &ao;
9
 
10
void test1(void)
11
{
12
    if (a->ch[a->l]) {
13
        ((char *)a->ch)[a->l] = 0;
14
    }
15
}
16
 
17
void test2(void)
18
{
19
    if (a->ch[a->l]) {
20
        ((char *)a->ch)[a->l] = -1;
21
    }
22
}
23
 
24
void test3(void)
25
{
26
    if (a->ch[a->l]) {
27
        ((char *)a->ch)[a->l] = 1;
28
    }
29
}
30
 
31
int main(void)
32
{
33
    test1();
34
    test2();
35
    test3();
36
    return 0;
37
}
38
 

powered by: WebSVN 2.1.0

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