public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug objc/36283]  New: When a class method, pointed by id, returns float, it returns wrong value
@ 2008-05-20 20:45 jongampark at sbcglobal dot net
  2008-05-20 21:03 ` [Bug objc/36283] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: jongampark at sbcglobal dot net @ 2008-05-20 20:45 UTC (permalink / raw)
  To: gcc-bugs

(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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-12-28 21:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-20 20:45 [Bug objc/36283] New: When a class method, pointed by id, returns float, it returns wrong value jongampark at sbcglobal dot net
2008-05-20 21:03 ` [Bug objc/36283] " pinskia at gcc dot gnu dot org
2008-05-20 21:06 ` pinskia at gcc dot gnu dot org
2008-05-21  2:57 ` jongampark at sbcglobal dot net
2008-05-21  3:01 ` jongampark at sbcglobal dot net
2008-05-21  4:41 ` jongampark at sbcglobal dot net
2008-05-21 14:57 ` jongampark at sbcglobal dot net
2008-12-28 21:39 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).