[/] [trunk/] [osprey/] - Rev 4059
Changes |
View Log |
Last modification
- Rev 4037 2012-10-16 10:39:46 GMT
- Author: laijx
- Log message:
- Fix bug #969, #970.
1. test case
#969 and #970 can be simplified to the following case:
struct I3 {
int a, b, c;
};
extern struct I3 foo();
void bar() {
struct I3 a;
a = foo();
}
The struct I1 can also be replaced by:
struct F3 {
float a, b, c;
};
2. IR dump
Open64 will allocate a temporary on stack for the return value. The IR
after MSTID lowering looks like:
MCALL 126 <1,51,foo> # flags 0x7e {line: 1/7}
I8I8LDID 1 <1,5,.preg_I8> T<5,.predef_I8,8> # $r1
I8STID 0 <2,2,_temp_.Mreturn.foo0> T<5,.predef_I8,8> {line: 0/0}
I8I8LDID 7 <1,5,.preg_I8> T<5,.predef_I8,8> # $r7
I8STID 8 <2,2,_temp_.Mreturn.foo0> T<5,.predef_I8,8> {line: 0/0}
[2]: _temp_.Mreturn.foo0 <2,2> Variable of type I1 (#53, KIND_STRUCT)
Address: 0(_temp_.Mreturn.foo0<2,2>) Alignment: 8 bytes
location: file (null), line 0
Flags: 0x00400000 temp, XLOCAL
Sclass: AUTO
[53]: I3 : (f: 0x1000 content_seen) size 12 M: STRUCT
0 a .predef_I4 (#4) align 4
fl:0x0000
4 b .predef_I4 (#4) align 4
fl:0x0000
8 c .predef_I4 (#4) align 4
fl:0x0001 last_field
The size of _temp_.Mreturn.foo0 is only 12 byte. The I8STID will
overwrite some other variables on stack. For float struct F3, two
F8STID will be generated.
Approved by Sun Chan. Thanks Huan Luo to test this patch on PPC.