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/] [pr11864-1.c] - Diff between revs 298 and 338

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

Rev 298 Rev 338
/* PR optimization/11864
/* PR optimization/11864
 * Reporter: Kazumoto Kojima <kkojima@gcc.gnu.org>
 * Reporter: Kazumoto Kojima <kkojima@gcc.gnu.org>
 * Summary: [3.3/3.4 regression] miscompiles zero extension and test
 * Summary: [3.3/3.4 regression] miscompiles zero extension and test
 * Description:
 * Description:
 * gcc-3.3/3.4 -O2 for sh target may miscompile the combination of zero extension
 * gcc-3.3/3.4 -O2 for sh target may miscompile the combination of zero extension
 * and test if it's zero.
 * and test if it's zero.
 *
 *
 * Testcase tweaked by dank@kegel.com.  Not marked as xfail because it's a regression.
 * Testcase tweaked by dank@kegel.com.  Not marked as xfail because it's a regression.
 */
 */
/* { dg-do run } */
/* { dg-do run } */
/* { dg-options "-O2" } */
/* { dg-options "-O2" } */
 
 
extern void abort(void);
extern void abort(void);
 
 
int val = 0xff00;
int val = 0xff00;
 
 
int f(void)
int f(void)
{
{
        return val;
        return val;
}
}
 
 
unsigned char a[1];
unsigned char a[1];
 
 
void foo(void)
void foo(void)
{
{
        a[0] = f() & 255;
        a[0] = f() & 255;
 
 
        if (!a[0])
        if (!a[0])
                a[0] = f() & 255;
                a[0] = f() & 255;
 
 
        if (!a[0])
        if (!a[0])
                a[0] = 1 + (f() & 127);
                a[0] = 1 + (f() & 127);
}
}
 
 
int main(int argc, char **argv)
int main(int argc, char **argv)
{
{
        foo();
        foo();
        if (!a[0])
        if (!a[0])
                abort();
                abort();
 
 
        return 0;
        return 0;
}
}
 
 

powered by: WebSVN 2.1.0

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