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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [pr11864-1.c] - Blame information for rev 149

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

Line No. Rev Author Line
1 149 jeremybenn
/* PR optimization/11864
2
 * Reporter: Kazumoto Kojima <kkojima@gcc.gnu.org>
3
 * Summary: [3.3/3.4 regression] miscompiles zero extension and test
4
 * Description:
5
 * gcc-3.3/3.4 -O2 for sh target may miscompile the combination of zero extension
6
 * and test if it's zero.
7
 *
8
 * Testcase tweaked by dank@kegel.com.  Not marked as xfail because it's a regression.
9
 */
10
/* { dg-do run } */
11
/* { dg-options "-O2" } */
12
 
13
extern void abort(void);
14
 
15
int val = 0xff00;
16
 
17
int f(void)
18
{
19
        return val;
20
}
21
 
22
unsigned char a[1];
23
 
24
void foo(void)
25
{
26
        a[0] = f() & 255;
27
 
28
        if (!a[0])
29
                a[0] = f() & 255;
30
 
31
        if (!a[0])
32
                a[0] = 1 + (f() & 127);
33
}
34
 
35
int main(int argc, char **argv)
36
{
37
        foo();
38
        if (!a[0])
39
                abort();
40
 
41
        return 0;
42
}

powered by: WebSVN 2.1.0

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