This is the mail archive of the gcc-bugs@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]
Other format: [Raw text]

[Bug c++/16607] Incorrect FP code generated in member data initialization


------- Additional Comments From npr1 at suomi24 dot fi  2004-07-19 02:01 -------
To bring up the error in compilation clearly, here's a part of the original 
program's assembly, for essentially this part of code:

struct C {
	double x;
	C(double x_) : x(x_) { }
};

void f(float x) {
	const double y = x * .9f;
	new C(y);
}

The above code alone doesn't compile that way, though. This is just to 
illustrate what I left to show in the assembly.

_Z1ff:
        ; snip stack frame setup
        flds    8(%ebp)
        fld     %st(0)
        fmuls   .LC0	; .LC0 is ".9f", obviously
        fsts    -28(%ebp)	; float version saved for some reason (*bug*)
        fstpl   -24(%ebp)	; this is later used in other uses of y
        ; snip code for the "if" which is in the original program
        pushl   $8
        call    _Znwj
        movl    %eax, %ebx
        flds    -28(%ebp)	; the float version loaded (*bug*)
        fstpl   (%eax)	; and saved as double x

I forgot to reopen the bug last time, doing it now.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|DUPLICATE                   |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16607


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