Johan Bezem

CW71, ColdFire: Missing prototype results in wrong code?

Discussion created by Johan Bezem on Feb 23, 2009
Latest reply on Feb 24, 2009 by Johan Bezem

In my project, moving from CW6.3 to 7.1 (Target CodFire), an error occurred. It appears that 7.1 uses different registers for returning values like 'int' (in D0) and pointers (in A0).

Now, if a call to 'malloc' is used without a prototype in view, the compiler assumes a return value typed 'int', and looks for the return value in D0.

However, 'malloc' really returns a pointer, so the return value is passed in A0.


According to my understanding of C, this is a real error, not reconcileable with the Standard: Implicit conversions will be applicable in such a case, converting an int to a pointer, however, it seems not permissible to lose the return value altogether, even when no prototype is used.


Can anyone confirm my observation? Is this a known error for Freescale already, and if not, where do I report this as an error? Is there a fix available?