Displaying 1 result from an estimated 1 matches for "new_s3".
Did you mean:
new_sk
2010 Jul 08
1
[LLVMdev] X86 gcc and clang have incompatible calling conventions for returning some small structs?
...e
following code:
> struct s {
> int a;
> int b;
> };
>
> struct s3 {
> int a;
> int b;
> int c;
> };
>
> struct s new_s(int v){
> struct s res;
> res.a = v;
> res.b = -v;
> return res;
> }
>
> struct s3 new_s3(int v){
> struct s3 res;
> res.a = v;
> res.b = -v;
> res.c = v<<2;
> return res;
> }
For the function new_s() both the current Ubuntu gcc and the current Ubuntu clang generate code to return struct s in registers.
However for the function new_s3() the...