This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Incompatability between APCS and ATPCS


Nick Clifton wrote:
 
> I already have a patched developed to add this feature to the linker,
> should we decide that this is the correct solution tot he problem.

That's what I had in mind.

> : [Aside: How long are we going to maintain the two separate
> : development streams?]
> Not much longer, I hope.

Me either.  My last build and test on the arm-thumb branch went really well. 
The number of testsuite failures is way down, and I think I have tracked down
the reasons the floating point comparison test suites fail.  Seems to be a bug
in glibc.

> It doesn't, although a similar solution could be used to distibguish
> between buggy and correct implementations of the APCS.

Ok.  Makes sense.

> Thanks for the corrections to my patch by the way.  I have
> incorporated them into my (un-checked-in) sources here.

You're welcome.

> : The only other thing I would be concerned about is how the compiler
> : handled code similar to the following with -matpcs on the command
> : line:
> :
> : typedef struct tagFOO {char a; char b;} FOO;
> :
> : FOO bar (char a, char b)
> : {
> :   FOO f;
> :   f.a = a;
> :   f.b = b;
> :   return f;
> : }
> :
> : int main (int argc, char *argv)
> : {
> :    printf ("address of FOO.b = 0x%08x\n", &bar('a','b').b);
> : }
> 
> This is not a problem.  Such code is illegal and produces this error
> message from GCC:
> 
>   scott.c: In function `main':
>   scott.c:13: invalid lvalue in unary `&'

Why is this illegal?   I was trying to take the address of the member b of the
returned struct.  Perhaps I need &( ( bar ('a','b') ).b ).
It seems to be a legal thing to do.  I would expect the compiler to use a
temporary for the return value.

Scott

-- 
Scott Bambrough - Software Engineer
REBEL.COM    http://www.rebel.com
NetWinder    http://www.netwinder.org

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]