(I don't know if this happens only to gcc 3.4.5 from the MingW and if it was solved already in newer versions.)
I made two classes inherited from a common parent class in Objective-C. The two children classes have methods, "- (float) data" and "- (int) data" respectively. They are for returning data value contained in each classes, or more accurately, their class instances. I would like to show a code example. @implementation GFloat : Generics - (id) add:(id) aVal { float value, value2; int value3; value = [aVal data]; // This can't return a float value in "aVal" correctly. value2 = returnFloat(); // C function returns a float value correctly. value3 = returnInt(); // C function returns a int value correctly. printf("%f, %f and %d\n", value, value2, value3); .... The method, "add", takes the aVal as an id type. By sending "data" message to aVal, it calls GFloat's data method successfully. So, inside of the data method/message, correct data value is fetched and returned. However, from the caller's line, which is shown above, the returned value is something other than what the "data" message returned. When the aVal is casted to (GFloat *), its returned value is correct. Is it weird because it returns wrong value although correct method is called. I would like to test the code at home with my MacOS X machine. -- Summary: When a class method, pointed by id, returns float, it returns wrong value Product: gcc Version: 3.4.5 Status: UNCONFIRMED Severity: critical Priority: P3 Component: objc AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jongampark at sbcglobal dot net http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36283