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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [opt/] [nrv11.C] - Blame information for rev 749

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

Line No. Rev Author Line
1 693 jeremybenn
// PR middle-end/25977
2
// Bug: We were assuming that the return slot of the current function is
3
// always safe to use as the return slot for another call, because its
4
// address cannot escape.  But its address can escape if we perform the
5
// named return value optimization.
6
 
7
// { dg-do run }
8
 
9
struct A
10
{
11
    A( int left, int top, int width, int height )
12
      : x1(left), y1(top), x2(left+width-1), y2(top+height-1) {}
13
 
14
    //A(const A& o) : x1(o.x1), y1(o.y1), x2(o.x2), y2(o.y2) {}
15
    //A& operator=(const A& o ) { x1=o.x1; y1=o.y1; x2=o.x2; y2=o.y2; return *this; }
16
 
17
    A  operator&(const A &r) const
18
    {
19
        A tmp(0, 0, -1, -1);
20
        tmp.x1 = ((r.x1) < (x1) ? (x1) : (r.x1));
21
        tmp.x2 = ((x2) < (r.x2) ? (x2) : (r.x2));
22
        tmp.y1 = ((r.y1) < (y1) ? (y1) : (r.y1));
23
        tmp.y2 = ((y2) < (r.y2) ? (y2) : (r.y2));
24
        return tmp;
25
    }
26
 
27
    int x1;
28
    int y1;
29
    int x2;
30
    int y2;
31
};
32
 
33
bool operator==( const A &r1, const A &r2 )
34
{
35
    return r1.x1==r2.x1 && r1.x2==r2.x2 && r1.y1==r2.y1 && r1.y2==r2.y2;
36
}
37
 
38
static A test()
39
{
40
    A all = A( 0, 0, 1024, 768);
41
    A a = all;
42
    A r = all;
43
    a = a & r;
44
    return a;
45
}
46
 
47
extern "C" void abort(void);
48
 
49
int main( int argc, char ** argv )
50
{
51
    A all = A( 0, 0, 1024, 768);
52
    A a = test();
53
 
54
    if ( ! ( a == all))
55
      abort();
56
 
57
    return 0;
58
}

powered by: WebSVN 2.1.0

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